Class MapUtils
java.lang.Object
overit.geocallapp.utilities.datatype.MapUtils
Utility class providing enhanced map operations with null safety and additional functionality
beyond standard Java Map methods.
This class provides utility methods for safe map operations, including retrieval of values with default fallbacks and enhanced type safety.
- Since:
- 1.0
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
MapUtils
public MapUtils()
-
-
Method Details
-
getOrElse
Retrieves a value from a map or returns a default value if the key is not found or maps to null.This method provides a functional programming style alternative to
Map.getOrDefault(Object, Object)with additional validation to ensure non-null parameters.- Type Parameters:
K- the type of keys maintained by the mapV- the type of mapped values- Parameters:
map- the map from which to retrieve the value (must not be null)key- the key whose associated value is to be returned (must not be null)defaultValue- the default value to return if the key is not found or maps to null- Returns:
- the value associated with the key, or the default value if the key is not found or maps to null
- Since:
- 1.0
-