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 |
|---|---|
java.util.Set<V> |
makeCollection()
Generates a new, mutable, empty
Collection. |
java.util.Set<V> |
makeCollection(java.util.Collection<? extends V> c)
Generates a new, mutable
Collection, using the
elements of c as a template for its initial
contents. |
java.util.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. |
java.util.Set<V> |
makeSet()
Generates a new, mutable, empty
Set. |
abstract java.util.Set<V> |
makeSet(java.util.Collection<? extends V> c)
Generates a new mutable
Set, using the elements
of c as a template for its initial contents. |
java.util.Set<V> |
makeSet(int initialCapacity)
Generates a new, mutable, empty
Set, using
initialCapacity as a hint to use for the capacity
for the produced Set. |
public SetFactory()
SetFactory.public final java.util.Set<V> makeCollection()
CollectionFactoryCollection.makeCollection in class CollectionFactory<V>public final java.util.Set<V> makeCollection(java.util.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 java.util.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 java.util.Set<V> makeSet()
Set.public java.util.Set<V> makeSet(int initialCapacity)
Set, using
initialCapacity as a hint to use for the capacity
for the produced Set.Copyright (c) 2006 C. Scott Ananian