Class CollectionFactory


  • public class CollectionFactory
    extends java.lang.Object
    CollectionFactory - a central place for allocating sets and maps, mostly so that it's easy to plug in new implementations (eg trove).
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <K,​V>
      java.util.Map<K,​V>
      createHashedMap()
      Answer a new Map which uses hashing for lookup.
      static <K,​V>
      java.util.Map<K,​V>
      createHashedMap​(int size)
      Answer a new Map which uses hashing for lookup and has initial size size.
      static <K,​V>
      java.util.Map<K,​V>
      createHashedMap​(java.util.Map<K,​V> toCopy)
      Answer a new Map which uses hashing for lookup and is initialised to be a copy of toCopy.
      static <T> java.util.Set<T> createHashedSet()
      Answer a new Set which uses haashing for lookup.
      static <T> java.util.Set<T> createHashedSet​(java.util.Collection<T> toCopy)
      Answer a new Set which uses hashing for lookup and is initialised as a copy of toCopy.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CollectionFactory

        public CollectionFactory()
    • Method Detail

      • createHashedMap

        public static <K,​V> java.util.Map<K,​V> createHashedMap()
        Answer a new Map which uses hashing for lookup.
      • createHashedMap

        public static <K,​V> java.util.Map<K,​V> createHashedMap​(int size)
        Answer a new Map which uses hashing for lookup and has initial size size.
      • createHashedMap

        public static <K,​V> java.util.Map<K,​V> createHashedMap​(java.util.Map<K,​V> toCopy)
        Answer a new Map which uses hashing for lookup and is initialised to be a copy of toCopy.
      • createHashedSet

        public static <T> java.util.Set<T> createHashedSet()
        Answer a new Set which uses haashing for lookup.
      • createHashedSet

        public static <T> java.util.Set<T> createHashedSet​(java.util.Collection<T> toCopy)
        Answer a new Set which uses hashing for lookup and is initialised as a copy of toCopy.