|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.cscott.jutil.CollectionFactory<V> net.cscott.jutil.SetFactory<V>
public abstract class SetFactory<V>
SetFactory
is a Set
generator.
Subclasses should implement constructions of specific types of
Set
s.
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 Summary | |
---|---|
SetFactory()
Creates a SetFactory . |
Method Summary | |
---|---|
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)
Generates a new, mutable, empty Set , using
initialCapacity as a hint to use for the capacity
for the produced Set . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SetFactory()
SetFactory
.
Method Detail |
---|
public final Set<V> makeCollection()
CollectionFactory
Collection
.
makeCollection
in class CollectionFactory<V>
public final Set<V> makeCollection(Collection<? extends V> c)
CollectionFactory
Collection
, 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)
CollectionFactory
Collection
, using
initialCapacity
as a hint to use for the capacity
for the produced Collection
.
makeCollection
in class CollectionFactory<V>
public Set<V> makeSet()
Set
.
public Set<V> makeSet(int initialCapacity)
Set
, using
initialCapacity
as a hint to use for the capacity
for the produced Set
.
public abstract Set<V> makeSet(Collection<? extends V> c)
Set
, using the elements
of c
as a template for its initial contents.
|
JUtil | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |