Class CollectionsFactory

java.lang.Object
tools.refinery.interpreter.matchers.util.CollectionsFactory

public final class CollectionsFactory extends Object
Factory class used as an accessor to Collections implementations.
  • Constructor Details

    • CollectionsFactory

      public CollectionsFactory()
  • Method Details

    • createMap

      public static <K, V> Map<K,V> createMap()
      Instantiates a new empty map.
      Since:
      1.7
    • createMap

      public static <K, V> Map<K,V> createMap(Map<K,V> initial)
      Instantiates a new map with the given initial contents.
      Since:
      1.7
    • createTreeMap

      public static <K, V> TreeMap<K,V> createTreeMap()
      Instantiates a new tree map.
      Since:
      2.3
    • createSet

      public static <E> Set<E> createSet()
      Instantiates a new empty set.
      Since:
      1.7
    • createSet

      public static <E> Set<E> createSet(Collection<E> initial)
      Instantiates a new set with the given initial contents.
      Since:
      1.7
    • emptySet

      public static <T> Set<T> emptySet(Object key)
      Instantiates an empty set; the key parameter is used to allow using this as a method reference as a Function, e.g. in Map.computeIfAbsent(Object, Function).
      Parameters:
      key - the value of this parameter is ignored
      Since:
      2.0
    • createMultiset

      public static <T> IMultiset<T> createMultiset()
      Instantiates a new empty multiset.
      Since:
      1.7
    • emptyMultiset

      public 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 a Function, e.g. in Map.computeIfAbsent(Object, Function).
      Parameters:
      key - the value of this parameter is ignored
      Since:
      2.0
    • createDeltaBag

      public static <T> IDeltaBag<T> createDeltaBag()
      Instantiates a new empty delta bag.
      Since:
      1.7
    • createObserverList

      public static <O> List<O> 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