public final class HashCollections extends Object
ImmutableMap
/ImmutableSet
factory is used.Maps
/Sets
factory is used.Maps
/Sets
is used by default instead.)
Modifier and Type | Field and Description |
---|---|
static String |
HASH_COLLECTION_FACTORY_SYSTEM_PROPERTY_NAME
Name of system property for setting the
HashCollectionFactory implementation class. |
Constructor and Description |
---|
HashCollections() |
Modifier and Type | Method and Description |
---|---|
static <K,V> Map<K,V> |
newImmutableMap(K k1,
V v1)
Constructs a new immutable map of the single specified mapping.
|
static <K,V> Map<K,V> |
newImmutableMap(K k1,
V v1,
K k2,
V v2)
Constructs a new immutable map of the two specified mappings.
|
static <K,V> Map<K,V> |
newImmutableMap(K k1,
V v1,
K k2,
V v2,
K k3,
V v3)
Constructs a new immutable map of the three specified mappings.
|
static <K,V> Map<K,V> |
newImmutableMap(Map<? extends K,? extends V> map)
Constructs a new immutable map with the same mappings as the specified map.
|
static <K,V> Map<K,V> |
newImmutableMap(Map<? extends K,? extends V> map1,
Map<? extends K,? extends V> map2)
Constructs a new immutable map which merges the mappings of the specified maps.
|
static <E> Set<E> |
newImmutableSet(E e1)
Constructs a new immutable singleton set of the given element.
|
static <E> Set<E> |
newImmutableSet(E[] elements)
Constructs a new immutable set of elements from the given array.
|
static <E> Set<E> |
newImmutableSet(Iterable<? extends E> elements)
Constructs a new immutable set containing the elements in the specified iterable.
|
static <E> Set<E> |
newImmutableSet(Set<? extends E> set1,
Set<? extends E> set2)
Constructs a new immutable set which merges the elements of the specified sets.
|
static <K,V> Map<K,V> |
newMutableMap()
Constructs a new empty mutable map of the default expected size (depending on the underlying implementation).
|
static <K,V> Map<K,V> |
newUpdatableMap()
Constructs a new empty updatable map of the default expected size (depending on the underlying implementation).
|
static <K,V> Map<K,V> |
newUpdatableMap(int expectedSize)
Constructs a new empty updatable map of the given expected size.
|
static <K,V> Map<K,V> |
newUpdatableMap(Map<? extends K,? extends V> map)
Constructs a new updatable map with the same mappings as the specified map.
|
static <K,V> Map<K,V> |
newUpdatableMap(Map<? extends K,? extends V> map1,
Map<? extends K,? extends V> map2)
Constructs a new updatable map which merge the mappings of the specified maps.
|
static <K,V> Map<K,V> |
newUpdatableMap(Map<? extends K,? extends V> map1,
Map<? extends K,? extends V> map2,
Map<? extends K,? extends V> map3)
Constructs a new updatable map which merge the mappings of the specified maps.
|
static <E> Set<E> |
newUpdatableSet()
Constructs a new empty updatable set of the default expected size (depending on the underlying implementation).
|
static <E> Set<E> |
newUpdatableSet(int expectedSize)
Constructs a new empty updatable set of the given expected size.
|
static <E> Set<E> |
newUpdatableSet(Iterable<? extends E> elements)
Constructs a new updatable set containing the elements in the specified iterable.
|
public static final String HASH_COLLECTION_FACTORY_SYSTEM_PROPERTY_NAME
HashCollectionFactory
implementation class. Default: DefaultHashCollectionFactory
.public static <K,V> Map<K,V> newMutableMap()
public static <K,V> Map<K,V> newUpdatableMap()
public static <K,V> Map<K,V> newUpdatableMap(int expectedSize)
expectedSize
- expected size of the returned mappublic static <K,V> Map<K,V> newUpdatableMap(Map<? extends K,? extends V> map)
map
- the map whose mappings are to be placed in the returned mappublic static <K,V> Map<K,V> newUpdatableMap(Map<? extends K,? extends V> map1, Map<? extends K,? extends V> map2)
map1
- the first map to mergemap2
- the second map to mergepublic static <K,V> Map<K,V> newUpdatableMap(Map<? extends K,? extends V> map1, Map<? extends K,? extends V> map2, Map<? extends K,? extends V> map3)
map1
- the first map to mergemap2
- the second map to mergemap3
- the third map to mergepublic static <K,V> Map<K,V> newImmutableMap(Map<? extends K,? extends V> map)
map
- the map whose mappings are to be placed in the returned mappublic static <K,V> Map<K,V> newImmutableMap(Map<? extends K,? extends V> map1, Map<? extends K,? extends V> map2)
map1
- the first map to mergemap2
- the second map to mergepublic static <K,V> Map<K,V> newImmutableMap(K k1, V v1)
k1
- the key of the sole mappingv1
- the value of the sole mappingpublic static <K,V> Map<K,V> newImmutableMap(K k1, V v1, K k2, V v2)
k1
- the key of the first mappingv1
- the value of the first mappingk2
- the key of the second mappingv2
- the value of the second mappingpublic static <K,V> Map<K,V> newImmutableMap(K k1, V v1, K k2, V v2, K k3, V v3)
k1
- the key of the first mappingv1
- the value of the first mappingk2
- the key of the second mappingv2
- the value of the second mappingk3
- the key of the third mappingv3
- the value of the third mappingpublic static <E> Set<E> newUpdatableSet()
public static <E> Set<E> newUpdatableSet(int expectedSize)
expectedSize
- the expected size of the returned setpublic static <E> Set<E> newUpdatableSet(Iterable<? extends E> elements)
elements
- the iterable whose elements are to be placed into the returned setpublic static <E> Set<E> newImmutableSet(E[] elements)
elements
- the array whose elements are to be placed into the returned setpublic static <E> Set<E> newImmutableSet(Set<? extends E> set1, Set<? extends E> set2)
set1
- the first source of elements for the returned setset2
- the second source of elements for the returned setpublic static <E> Set<E> newImmutableSet(Iterable<? extends E> elements)
elements
- the iterable whose elements are to be placed into the returned setpublic static <E> Set<E> newImmutableSet(E e1)
e1
- the sole elementCopyright © 2012–2020. All rights reserved.