public abstract class SetFactory<V> extends CollectionFactory<V>
SetFactory is a Set generator.
Subclasses should implement constructions of specific types of
Sets.
Note also that the current limitations on parametric types in
Java mean that we can't easily type this class as
SetFactory<S extends Set<V>,V>,
as SetFactory<HashSet<V>,V> is not
a subtype of SetFactory<Set<V>,V>,
even though HashSet is a subtype of Set.
| Constructor and Description |
|---|
SetFactory()
Creates a
SetFactory. |
| Modifier and Type | Method and Description |
|---|---|
Set<V> |
makeCollection()
Generates a new, mutable, empty
Collection. |
Set<V> |
makeCollection(Collection<? extends V> c)
Generates a new, mutable
Collection, using the
elements of c as a template for its initial
contents. |
Set<V> |
makeCollection(int initCapacity)
Generates a new, mutable, empty
Collection, using
initialCapacity as a hint to use for the capacity
for the produced Collection. |
Set<V> |
makeSet()
Generates a new, mutable, empty
Set. |
abstract Set<V> |
makeSet(Collection<? extends V> c)
Generates a new mutable
Set, using the elements
of c as a template for its initial contents. |
Set<V> |
makeSet(int initialCapacity)
|
public SetFactory()
SetFactory.public final Set<V> makeCollection()
CollectionFactoryCollection.makeCollection in class CollectionFactory<V>public final Set<V> makeCollection(Collection<? extends V> c)
CollectionFactoryCollection, using the
elements of c as a template for its initial
contents. Note that the Collection returned is
not a view of c, but rather a snapshot;
changes to c are not reflected in the returned
Collection.makeCollection in class CollectionFactory<V>public final Set<V> makeCollection(int initCapacity)
CollectionFactoryCollection, using
initialCapacity as a hint to use for the capacity
for the produced Collection.makeCollection in class CollectionFactory<V>public abstract Set<V> makeSet(Collection<? extends V> c)
Set, using the elements
of c as a template for its initial contents.Copyright (c) 2006 C. Scott Ananian