Class DefaultSpeciesNewStrategy


  • public class DefaultSpeciesNewStrategy
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private static <T> java.util.Collection<T> createNewInstanceForCollectionType​(java.util.Collection<?> collection)  
      <T> java.util.Collection<T> speciesNew​(java.util.Collection<?> collection)
      Creates a new instance of a collection based on the class type of collection, not on the type of objects the collections contains.
      <T> java.util.Collection<T> speciesNew​(java.util.Collection<?> collection, int size)
      Creates a new instance of a collection based on the class type of collection and specified initial capacity, not on the type of objects the collections contains.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SIZE_CONSTRUCTOR_TYPES

        private static final java.lang.Class<?>[] SIZE_CONSTRUCTOR_TYPES
    • Constructor Detail

      • DefaultSpeciesNewStrategy

        public DefaultSpeciesNewStrategy()
    • Method Detail

      • speciesNew

        public <T> java.util.Collection<T> speciesNew​(java.util.Collection<?> collection)
        Creates a new instance of a collection based on the class type of collection, not on the type of objects the collections contains. e.g. CollectionFactory.<Integer>speciesNew(hashSetOfString) returns a new HashSet<Integer>(); e.g. CollectionFactory.<Date>speciesNew(linkedListOfWombles) returns a new LinkedList<Date>();
      • speciesNew

        public <T> java.util.Collection<T> speciesNew​(java.util.Collection<?> collection,
                                                      int size)
        Creates a new instance of a collection based on the class type of collection and specified initial capacity, not on the type of objects the collections contains. e.g. CollectionFactory.<Integer>speciesNew(hashSetOfString, 20) returns a new HashSet<Integer>(20); e.g. CollectionFactory.<Date>speciesNew(linkedListOfWombles, 42) returns a new LinkedList<Date>(42);
      • createNewInstanceForCollectionType

        private static <T> java.util.Collection<T> createNewInstanceForCollectionType​(java.util.Collection<?> collection)