public class Maps
extends java.lang.Object
| Constructor and Description |
|---|
Maps() |
| Modifier and Type | Method and Description |
|---|---|
static <T extends java.util.Map<K,V>,K,V> |
any(java.util.function.Supplier<T> mapSupplier,
java.util.function.Consumer<T> mapConsumer)
Create a new map which is passed to the given consumer.
|
static <T extends java.util.Map<K,V>,K,V> |
any(java.util.function.Supplier<T> mapSupplier,
java.lang.Object... objects)
Create a new map with the given objects.
|
static <K,V> java.util.concurrent.ConcurrentHashMap<K,V> |
concurrentHashMap(java.util.function.Consumer<java.util.concurrent.ConcurrentHashMap<K,V>> mapConsumer)
Create a new
ConcurrentHashMap which is passed to the given consumer. |
static <K,V> java.util.concurrent.ConcurrentHashMap<K,V> |
concurrentHashMap(java.lang.Object... objects)
Create a new
ConcurrentHashMap with the given objects. |
static <K,V> java.util.HashMap<K,V> |
hashMap(java.util.function.Consumer<java.util.HashMap<K,V>> mapConsumer)
Create a new
HashMap which is passed to the given consumer. |
static <K,V> java.util.HashMap<K,V> |
hashMap(java.lang.Object... objects)
Create a new
HashMap with the given objects. |
static <K,V> java.util.LinkedHashMap<K,V> |
linkedHashMap(java.util.function.Consumer<java.util.LinkedHashMap<K,V>> mapConsumer)
Create a new
LinkedHashMap which is passed to the given consumer. |
static <K,V> java.util.LinkedHashMap<K,V> |
linkedHashMap(java.lang.Object... objects)
Create a new
LinkedHashMap with the given objects. |
static <K,V> java.util.Map<K,V> |
merge(java.util.Map<K,V> map,
java.util.Map<K,V>... others)
Merge multiple maps into one.
|
static <K,V> java.util.LinkedHashMap<K,V> |
sort(java.util.Map<K,V> map,
java.util.Comparator<java.util.Map.Entry<K,V>> comparator)
Sort a map using the given comparator.
|
public static <K,V> java.util.LinkedHashMap<K,V> sort(java.util.Map<K,V> map,
java.util.Comparator<java.util.Map.Entry<K,V>> comparator)
LinkedHashMap to keep the order of the map.K - The key typeV - The value typemap - The map to sortcomparator - The comparator to use@SafeVarargs
public static <K,V> java.util.Map<K,V> merge(java.util.Map<K,V> map,
java.util.Map<K,V>... others)
K - The key typeV - The value typemap - The first mapothers - The other mapspublic static <T extends java.util.Map<K,V>,K,V> T any(java.util.function.Supplier<T> mapSupplier,
java.lang.Object... objects)
key, value, key, value, ...T - The map typeK - The key typeV - The value typemapSupplier - The supplier to create the mapobjects - The objects to add to the mappublic static <T extends java.util.Map<K,V>,K,V> T any(java.util.function.Supplier<T> mapSupplier,
java.util.function.Consumer<T> mapConsumer)
T - The map typeK - The key typeV - The value typemapSupplier - The supplier to create the mapmapConsumer - The consumer to pass the map topublic static <K,V> java.util.HashMap<K,V> hashMap(java.lang.Object... objects)
HashMap with the given objects.key, value, key, value, ...K - The key typeV - The value typeobjects - The objects to add to the mappublic static <K,V> java.util.HashMap<K,V> hashMap(java.util.function.Consumer<java.util.HashMap<K,V>> mapConsumer)
HashMap which is passed to the given consumer.K - The key typeV - The value typemapConsumer - The consumer to pass the map topublic static <K,V> java.util.LinkedHashMap<K,V> linkedHashMap(java.lang.Object... objects)
LinkedHashMap with the given objects.key, value, key, value, ...K - The key typeV - The value typeobjects - The objects to add to the mappublic static <K,V> java.util.LinkedHashMap<K,V> linkedHashMap(java.util.function.Consumer<java.util.LinkedHashMap<K,V>> mapConsumer)
LinkedHashMap which is passed to the given consumer.K - The key typeV - The value typemapConsumer - The consumer to pass the map topublic static <K,V> java.util.concurrent.ConcurrentHashMap<K,V> concurrentHashMap(java.lang.Object... objects)
ConcurrentHashMap with the given objects.key, value, key, value, ...K - The key typeV - The value typeobjects - The objects to add to the mappublic static <K,V> java.util.concurrent.ConcurrentHashMap<K,V> concurrentHashMap(java.util.function.Consumer<java.util.concurrent.ConcurrentHashMap<K,V>> mapConsumer)
ConcurrentHashMap which is passed to the given consumer.K - The key typeV - The value typemapConsumer - The consumer to pass the map to