public class DefaultSpeciesNewStrategy extends Object
Modifier and Type | Field | Description |
---|---|---|
static DefaultSpeciesNewStrategy |
INSTANCE |
Constructor | Description |
---|---|
DefaultSpeciesNewStrategy() |
Modifier and Type | Method | Description |
---|---|---|
<T> Collection<T> |
speciesNew(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> Collection<T> |
speciesNew(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.
|
public static final DefaultSpeciesNewStrategy INSTANCE
public <T> Collection<T> speciesNew(Collection<?> collection)
CollectionFactory.<Integer>speciesNew(hashSetOfString)
returns a new HashSet<Integer>()
;
e.g. CollectionFactory.<Date>speciesNew(linkedListOfWombles)
returns a new LinkedList<Date>()
;public <T> Collection<T> speciesNew(Collection<?> collection, int size)
CollectionFactory.<Integer>speciesNew(hashSetOfString, 20)
returns a new HashSet<Integer>(20)
;
e.g. CollectionFactory.<Date>speciesNew(linkedListOfWombles, 42)
returns a new LinkedList<Date>(42)
;Copyright © 2004–2019. All rights reserved.