public final class DefaultHashCollectionFactory extends Object implements HashCollectionFactory
HashCollectionFactory
based on Guava and native Java API. Default expected size is same as for Java API native HashMap
/HashSet
. This implementation
does not distinguish mutable from immutable Map, contrary to Koloboke for instance, therefore the returned Map implementation for newMutableMap()
and newUpdatableMap()
method
variants is the same.Constructor and Description |
---|
DefaultHashCollectionFactory() |
Modifier and Type | Method and Description |
---|---|
<K,V> Map<K,V> |
newImmutableMap(K k1,
V v1)
Constructs a new immutable map of the single specified mapping.
|
<K,V> Map<K,V> |
newImmutableMap(K k1,
V v1,
K k2,
V v2)
Constructs a new immutable map of the two specified mappings.
|
<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.
|
<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.
|
<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.
|
<E> Set<E> |
newImmutableSet(E e1)
Constructs a new immutable singleton set of the given element.
|
<E> Set<E> |
newImmutableSet(E[] elements)
Constructs a new immutable set of elements from the given array.
|
<E> Set<E> |
newImmutableSet(Iterable<? extends E> elements)
Constructs a new immutable set containing the elements in the specified iterable.
|
<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.
|
<K,V> Map<K,V> |
newMutableMap()
Constructs a new empty mutable map of the default expected size (depending on the implementation).
|
<K,V> Map<K,V> |
newUpdatableMap()
Constructs a new empty updatable map of the default expected size (depending on the underlying implementation).
|
<K,V> Map<K,V> |
newUpdatableMap(int expectedSize)
Constructs a new empty updatable map of the given expected size.
|
<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.
|
<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.
|
<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.
|
<E> Set<E> |
newUpdatableSet()
Constructs a new empty updatable set of the default expected size (depending on the underlying implementation).
|
<E> Set<E> |
newUpdatableSet(int expectedSize)
Constructs a new empty updatable set of the given expected size.
|
<E> Set<E> |
newUpdatableSet(Iterable<? extends E> elements)
Constructs a new updatable set containing the elements in the specified iterable.
|
public <K,V> Map<K,V> newMutableMap()
HashCollectionFactory
newMutableMap
in interface HashCollectionFactory
public <K,V> Map<K,V> newUpdatableMap()
HashCollectionFactory
newUpdatableMap
in interface HashCollectionFactory
public <K,V> Map<K,V> newUpdatableMap(int expectedSize)
HashCollectionFactory
newUpdatableMap
in interface HashCollectionFactory
expectedSize
- expected size of the returned mappublic <K,V> Map<K,V> newUpdatableMap(Map<? extends K,? extends V> map)
HashCollectionFactory
newUpdatableMap
in interface HashCollectionFactory
map
- the map whose mappings are to be placed in the returned mappublic <K,V> Map<K,V> newUpdatableMap(Map<? extends K,? extends V> map1, Map<? extends K,? extends V> map2)
HashCollectionFactory
newUpdatableMap
in interface HashCollectionFactory
map1
- the first map to mergemap2
- the second map to mergepublic <K,V> Map<K,V> newUpdatableMap(Map<? extends K,? extends V> map1, Map<? extends K,? extends V> map2, Map<? extends K,? extends V> map3)
HashCollectionFactory
newUpdatableMap
in interface HashCollectionFactory
map1
- the first map to mergemap2
- the second map to mergemap3
- the third map to mergepublic <K,V> Map<K,V> newImmutableMap(Map<? extends K,? extends V> map)
HashCollectionFactory
newImmutableMap
in interface HashCollectionFactory
map
- the map whose mappings are to be placed in the returned mappublic <K,V> Map<K,V> newImmutableMap(Map<? extends K,? extends V> map1, Map<? extends K,? extends V> map2)
HashCollectionFactory
newImmutableMap
in interface HashCollectionFactory
map1
- the first map to mergemap2
- the second map to mergepublic <K,V> Map<K,V> newImmutableMap(K k1, V v1)
HashCollectionFactory
newImmutableMap
in interface HashCollectionFactory
k1
- the key of the sole mappingv1
- the value of the sole mappingpublic <K,V> Map<K,V> newImmutableMap(K k1, V v1, K k2, V v2)
HashCollectionFactory
newImmutableMap
in interface HashCollectionFactory
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 <K,V> Map<K,V> newImmutableMap(K k1, V v1, K k2, V v2, K k3, V v3)
HashCollectionFactory
newImmutableMap
in interface HashCollectionFactory
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 <E> Set<E> newUpdatableSet()
HashCollectionFactory
newUpdatableSet
in interface HashCollectionFactory
public <E> Set<E> newUpdatableSet(int expectedSize)
HashCollectionFactory
newUpdatableSet
in interface HashCollectionFactory
expectedSize
- the expected size of the returned setpublic <E> Set<E> newUpdatableSet(Iterable<? extends E> elements)
HashCollectionFactory
newUpdatableSet
in interface HashCollectionFactory
elements
- the iterable whose elements are to be placed into the returned setpublic <E> Set<E> newImmutableSet(E[] elements)
HashCollectionFactory
newImmutableSet
in interface HashCollectionFactory
elements
- the array whose elements are to be placed into the returned setpublic <E> Set<E> newImmutableSet(Iterable<? extends E> elements)
HashCollectionFactory
newImmutableSet
in interface HashCollectionFactory
elements
- the iterable whose elements are to be placed into the returned setpublic <E> Set<E> newImmutableSet(Set<? extends E> set1, Set<? extends E> set2)
HashCollectionFactory
newImmutableSet
in interface HashCollectionFactory
set1
- the first source of elements for the returned setset2
- the second source of elements for the returned setpublic <E> Set<E> newImmutableSet(E e1)
HashCollectionFactory
newImmutableSet
in interface HashCollectionFactory
e1
- the sole elementCopyright © 2012–2020. All rights reserved.