Class CollectionsFactory
java.lang.Object
tools.refinery.interpreter.matchers.util.CollectionsFactory
Factory class used as an accessor to Collections implementations.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface abstracting over a collections technology that provides custom collection implementations.static enumThe type ofIMemory -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> IDeltaBag<T> Instantiates a new empty delta bag.static <K,V> Map <K, V> Instantiates a new empty map.static <K,V> Map <K, V> Instantiates a new map with the given initial contents.static <T> IMemory<T> createMemory(Class<? super T> values, CollectionsFactory.MemoryType memoryType) Instantiates a memory storing values.static <K,V> IMultiLookup <K, V> createMultiLookup(Class<? super K> fromKeys, CollectionsFactory.MemoryType toBuckets, Class<? super V> ofValues) Instantiates a size-optimized multimap from keys to sets of values.static <T> IMultiset<T> Instantiates a new empty multiset.static <O> List<O> Instantiates a new list that is optimized for registering observers / callbacks.static <E> Set<E> Instantiates a new empty set.static <E> Set<E> createSet(Collection<E> initial) Instantiates a new set with the given initial contents.static <K,V> TreeMap <K, V> Instantiates a new tree map.static <T> IMultiset<T> emptyMultiset(Object key) Instantiates an empty multiset; the key parameter is used to allow using this as a method reference as aFunction, e.g.static <T> Set<T> Instantiates an empty set; the key parameter is used to allow using this as a method reference as aFunction, e.g.
-
Constructor Details
-
CollectionsFactory
public CollectionsFactory()
-
-
Method Details
-
createMap
Instantiates a new empty map.- Since:
- 1.7
-
createMap
Instantiates a new map with the given initial contents.- Since:
- 1.7
-
createTreeMap
Instantiates a new tree map.- Since:
- 2.3
-
createSet
Instantiates a new empty set.- Since:
- 1.7
-
createSet
Instantiates a new set with the given initial contents.- Since:
- 1.7
-
emptySet
Instantiates an empty set; the key parameter is used to allow using this as a method reference as aFunction, e.g. inMap.computeIfAbsent(Object, Function).- Parameters:
key- the value of this parameter is ignored- Since:
- 2.0
-
createMultiset
Instantiates a new empty multiset.- Since:
- 1.7
-
emptyMultiset
Instantiates an empty multiset; the key parameter is used to allow using this as a method reference as aFunction, e.g. inMap.computeIfAbsent(Object, Function).- Parameters:
key- the value of this parameter is ignored- Since:
- 2.0
-
createDeltaBag
Instantiates a new empty delta bag.- Since:
- 1.7
-
createObserverList
Instantiates a new list that is optimized for registering observers / callbacks.- Since:
- 1.7
-
createMultiLookup
public static <K,V> IMultiLookup<K,V> createMultiLookup(Class<? super K> fromKeys, CollectionsFactory.MemoryType toBuckets, Class<? super V> ofValues) Instantiates a size-optimized multimap from keys to sets of values.For a single key, many values can be associated according to the given bucket semantics.
The keys and values are stored as type fromKeys resp. ofValues; currently Object.class and Long.class are supported.
- Since:
- 2.0
-
createMemory
public static <T> IMemory<T> createMemory(Class<? super T> values, CollectionsFactory.MemoryType memoryType) Instantiates a memory storing values.For a single key, many values can be associated according to the given memory semantics.
The values are stored as type 'values'; currently Object.class and Long.class are supported.
- Since:
- 2.0
-