Package org.ow2.authzforce.core.pdp.api
Interface HashCollectionFactory
- All Known Implementing Classes:
DefaultHashCollectionFactory
public interface HashCollectionFactory
Factory method to construct HashMaps/HashSets. Implement this interface to allow AuthZForce code to use alternatives to Java native implementations, which alternatives must support:
- Immutable HashMap/HashSet implementations.
- Mutable HashMap/HashSet implementations accepting an expected size as constructor parameter.
-
Method Summary
Modifier and TypeMethodDescription<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.<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.<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> Constructs a new empty mutable map of the default expected size (depending on the implementation).<K,
V> Map<K, V> 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>
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.
-
Method Details
-
newMutableMap
Constructs a new empty mutable map of the default expected size (depending on the implementation).- Type Parameters:
K
- key typeV
- value type- Returns:
- a new empty mutable map
-
newUpdatableMap
Constructs a new empty updatable map of the default expected size (depending on the underlying implementation).- Type Parameters:
K
- key typeV
- value type- Returns:
- new empty updatable map
-
newUpdatableMap
Constructs a new empty updatable map of the given expected size.- Type Parameters:
K
- key typeV
- value type- Parameters:
expectedSize
- expected size of the returned map- Returns:
- a new empty updatable map of the given expected size (positive)
- Throws:
IllegalArgumentException
- ifexpectedSize
is negative
-
newUpdatableMap
Constructs a new updatable map with the same mappings as the specified map.- Type Parameters:
K
- key typeV
- value type- Parameters:
map
- the map whose mappings are to be placed in the returned map- Returns:
- a new updatable map with the same mappings as the specified map
-
newUpdatableMap
<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. On conflict, mappings from the map2 have priority over mappings from the map1 with the same keys.- Type Parameters:
K
- key typeV
- value type- Parameters:
map1
- the first map to mergemap2
- the second map to merge- Returns:
- a new updatable map which merges the mappings of the specified maps
-
newUpdatableMap
<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. On conflict, mappings from the maps passed later in the argument list have priority over mappings from the maps passed earlier with the same keys.- Type Parameters:
K
- key typeV
- value type- Parameters:
map1
- the first map to mergemap2
- the second map to mergemap3
- the third map to merge- Returns:
- a new updatable map which merges the mappings of the specified maps
-
newImmutableMap
Constructs a new immutable map with the same mappings as the specified map.- Type Parameters:
K
- key typeV
- value type- Parameters:
map
- the map whose mappings are to be placed in the returned map- Returns:
- a new immutable map with the same mappings as the specified map
-
newImmutableMap
<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. On conflict, mappings from the map2 have priority over mappings from the map1 with the same keys.- Type Parameters:
K
- key typeV
- value type- Parameters:
map1
- the first map to mergemap2
- the second map to merge- Returns:
- a new immutable map which merges the mappings of the specified maps
-
newImmutableMap
Constructs a new immutable map of the single specified mapping.- Type Parameters:
K
- key typeV
- value type- Parameters:
k1
- the key of the sole mappingv1
- the value of the sole mapping- Returns:
- a new immutable map of the single specified mapping
-
newImmutableMap
Constructs a new immutable map of the two specified mappings.- Type Parameters:
K
- key typeV
- value type- Parameters:
k1
- the key of the first mappingv1
- the value of the first mappingk2
- the key of the second mappingv2
- the value of the second mapping- Returns:
- Returns an immutable map containing the given entries, in order.
-
newImmutableMap
Constructs a new immutable map of the three specified mappings.- Type Parameters:
K
- key typeV
- value type- Parameters:
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 mapping- Returns:
- Returns an immutable map containing the given entries, in order.
-
newUpdatableSet
Constructs a new empty updatable set of the default expected size (depending on the underlying implementation).- Type Parameters:
E
- set element type- Returns:
- a new empty updatable set
-
newUpdatableSet
Constructs a new empty updatable set of the given expected size.- Type Parameters:
E
- set element type- Parameters:
expectedSize
- the expected size of the returned set- Returns:
- a new empty updatable set of the given expected size (positive)
- Throws:
IllegalArgumentException
- ifexpectedSize
is negative
-
newUpdatableSet
Constructs a new updatable set containing the elements in the specified iterable.- Type Parameters:
E
- element type- Parameters:
elements
- the iterable whose elements are to be placed into the returned set- Returns:
- a new updatable set of the elements of the specified iterable
-
newImmutableSet
Constructs a new immutable set of elements from the given array.- Type Parameters:
E
- element type- Parameters:
elements
- the array whose elements are to be placed into the returned set- Returns:
- a new immutable set of elements from the given array
-
newImmutableSet
Constructs a new immutable set containing the elements in the specified iterable.- Type Parameters:
E
- element type- Parameters:
elements
- the iterable whose elements are to be placed into the returned set- Returns:
- a new immutable set of the elements of the specified iterable
-
newImmutableSet
Constructs a new immutable set which merges the elements of the specified sets.- Type Parameters:
E
- element type- Parameters:
set1
- the first source of elements for the returned setset2
- the second source of elements for the returned set- Returns:
- a new immutable set which merges the elements of the specified sets
-
newImmutableSet
Constructs a new immutable singleton set of the given element.- Type Parameters:
E
- element type- Parameters:
e1
- the sole element- Returns:
- a new immutable singleton set of the given element
-