Package me.hsgamer.bettergui.util
Class MapUtil
- java.lang.Object
-
- me.hsgamer.bettergui.util.MapUtil
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Optional<Map<String,Object>>castOptionalStringObjectMap(Object object)Cast to the optional string-object mapstatic <K> booleancontainsAnyKey(Map<K,?> map, K... key)Check if the map contains any of the keysstatic <K,V>
VgetIfFound(Map<K,V> map, K... key)Get the value given the key from the mapstatic <K,V>
VgetIfFoundOrDefault(Map<K,V> map, V defaultValue, K... key)Get the value given the key from the map
-
-
-
Method Detail
-
getIfFoundOrDefault
@SafeVarargs public static <K,V> V getIfFoundOrDefault(Map<K,V> map, V defaultValue, K... key)
Get the value given the key from the map- Type Parameters:
K- the key typeV- the value type- Parameters:
map- the mapdefaultValue- the default valuekey- the key- Returns:
- the value
-
getIfFound
@SafeVarargs public static <K,V> V getIfFound(Map<K,V> map, K... key)
Get the value given the key from the map- Type Parameters:
K- the key typeV- the value type- Parameters:
map- the mapkey- the key- Returns:
- the value, or null if not found
-
containsAnyKey
@SafeVarargs public static <K> boolean containsAnyKey(Map<K,?> map, K... key)
Check if the map contains any of the keys- Type Parameters:
K- the key type- Parameters:
map- the mapkey- the key- Returns:
- true if it does
-
-