|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.staccatocommons.collections.Maps
public class Maps
Class methods for dealing with maps
| Constructor Summary | |
|---|---|
Maps()
|
|
| Method Summary | ||
|---|---|---|
static
|
anyKey(Map<K,?> map)
Answers Some(key) from the given Map, or None, if it is
empty. |
|
static
|
anyKeyOrNull(Map<K,?> map)
Answers a key from the given Map, or null, if it is empty. |
|
static
|
anyValue(Map<?,V> map)
Answers a Some(value) from the given Map, or
None, if it is empty. |
|
static
|
anyValueOrNull(Map<?,V> map)
Answers a value from the given Map, or null, if it is
empty. |
|
static
|
delayedMapKeys(Map<K,V1> map,
Applicable<? super V1,? extends V2> function)
|
|
static
|
from(Iterable<Tuple2<K,V>> entries)
Answers a new Unmodifiable map with the given entries |
|
static
|
from(Tuple2<K,V>... entries)
Answers a new Unmodifiable map with the given entries |
|
static
|
get(Map<?,V> map,
Object key)
Answers the optional value for the given key |
|
static
|
getExistent(Map<?,V> map,
Object key)
Answers the value for the given key. |
|
static boolean |
isNullOrEmpty(Map<?,?> map)
Answers if the given map is null or empty |
|
static
|
mapKeys(Map<K,V1> map,
Applicable<V1,V2> function)
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Maps()
| Method Detail |
|---|
@NonNull
public static <V> Option<V> get(@NonNull
Map<?,V> map,
Object key)
V - map - key - the key to lookup
@NonNull
public static <V> V getExistent(@NonNull
Map<?,V> map,
Object key)
NoSuchElementException if there is no mapping for it
V - map - key - the key to lookup
@NonNull
public static <K> Option<K> anyKey(@NonNull
Map<K,?> map)
Map, or None, if it is
empty. Notice that any does not mean random, it may return
always the same key, as this method just guarantees that if Some(key) is
returned, map.containsKey(key) will return true
K - map -
public static <K> K anyKeyOrNull(@NonNull
Map<K,?> map)
Map, or null, if it is empty. Notice
that any does not mean random, it may return always the
same key, as this method just guarantees that if a non null key is
returned, map.containsKey(key) will return true
K - map -
@NonNull
public static <V> Option<V> anyValue(@NonNull
Map<?,V> map)
Some(value) from the given Map, or
None, if it is empty. Notice that any does not mean
random, it may return always the same value, this method just
guarantees that if a Some(value) is returned,
map.containsValue(value) will return true
V - map -
public static <V> V anyValueOrNull(@NonNull
Map<?,V> map)
Map, or null, if it is
empty. Notice that any does not mean random, it may return
always the same value, as this method just guarantees that if a
value is returned, map.containsValue(value) will
return true
V - map -
value if map is not empty, null
otherwisepublic static boolean isNullOrEmpty(Map<?,?> map)
map -
map == null || map.isEmpty()
public static <K,V1,V2> Map<K,V2> mapKeys(Map<K,V1> map,
Applicable<V1,V2> function)
public static <K,V1,V2> Map<K,V2> delayedMapKeys(Map<K,V1> map,
Applicable<? super V1,? extends V2> function)
public static <K,V> Map<K,V> from(Iterable<Tuple2<K,V>> entries)
Unmodifiable map with the given entries
K - V - entries - the new map entries
public static <K,V> Map<K,V> from(Tuple2<K,V>... entries)
Unmodifiable map with the given entries
K - V - entries - the new map entries
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||