Class InfinispanCollections
java.lang.Object
org.infinispan.commons.util.InfinispanCollections
Static helpers for Infinispan-specific collections
- Since:
- 4.0
- Author:
- Manik Surtani
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA function that converts a type into another one.static interfaceA function that converts an entry into a key/value pair for use in a map. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertNotNullEntries(Collection<?> collection, String name) static voidassertNotNullEntries(Map<?, ?> map, String name) static <T> booleancontainsAny(Collection<T> haystack, Collection<T> needles) static <E> Set<E> difference(Set<? extends E> s1, Set<? extends E> s2) Returns the elements that are present in s1 but which are not present in s2, without changing the contents of neither s1, nor s2.static <T> voidstatic <T> List<T> mergeLists(List<T> one, List<T> second) static <K,V> Map <K, V> toObjectSet(Collection<?> collection) static <K,V, E> Map <K, V> transformCollectionToMap(Collection<? extends E> input, InfinispanCollections.MapMakerFunction<K, V, ? super E> f) Given a collection, transforms the collection to a map given aInfinispanCollections.MapMakerFunctionstatic <K,V, E> Map <K, V> transformMapValue(Map<K, E> input, InfinispanCollections.Function<E, V> f) Given a map of well known key/value types, it makes a shallow copy of it while at the same time transforming it's value type to a desired output type.
-
Method Details
-
transformMapValue
public static <K,V, Map<K,E> V> transformMapValue(Map<K, E> input, InfinispanCollections.Function<E, V> f) Given a map of well known key/value types, it makes a shallow copy of it while at the same time transforming it's value type to a desired output type. The transformation of the value type is done using a given a function.- Type Parameters:
K- input map's key typeV- desired output type of the map's valueE- input map's value type- Parameters:
input- contains the input key/value pair mapf- function instance to use to transform the value part of the map- Returns:
- a shallow copy of the input Map with all its values transformed.
-
transformCollectionToMap
public static <K,V, Map<K,E> V> transformCollectionToMap(Collection<? extends E> input, InfinispanCollections.MapMakerFunction<K, V, ? super E> f) Given a collection, transforms the collection to a map given aInfinispanCollections.MapMakerFunction- Type Parameters:
K- output map's key typeV- output type of the map's valueE- input collection's entry type- Parameters:
input- contains a collection of type Ef- MapMakerFunction instance to use to transform the collection to a key/value pair- Returns:
- a Map with keys and values generated from the input collection
-
difference
Returns the elements that are present in s1 but which are not present in s2, without changing the contents of neither s1, nor s2.- Type Parameters:
E- type of objects in Set- Parameters:
s1- first sets2- second set- Returns:
- the elements in s1 that are not in s2
-
containsAny
-
forEach
-
assertNotNullEntries
-
assertNotNullEntries
-
mergeMaps
-
mergeLists
-
toObjectSet
-