public class MapUtilities extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
get(Map<?,T> map,
Object key,
T def)
Retrieves a value from a map by key
|
static <T extends Throwable> |
getOrThrow(Map<?,?> map,
Object key,
T throwable)
Retrieves a value from a map by key, if value is not found by the given key throws a 'Throwable.'
This version allows the value associated to the key to be null, and it still works.
|
static boolean |
isEmpty(Map map)
Returns null safe isEmpty check for Map
|
public static <T> T get(Map<?,T> map, Object key, T def)
map - Map to retrieve item fromkey - the key whose associated value is to be returneddef - value to return if item was not found.public static <T extends Throwable> Object getOrThrow(Map<?,?> map, Object key, T throwable) throws T extends Throwable
T - Throwable passed in to be thrown *if* the passed in key is not within the passed in map.map - Map to retrieve item fromkey - the key whose associated value is to be returnedthrowable - T extends Throwablepublic static boolean isEmpty(Map map)
map - Map to check, can be nullCopyright © 2023. All rights reserved.