|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpaul.DataStructs.SetFactory<T>
public abstract class SetFactory<T>
SetFactory
is a set-instance of the factory pattern.
Default implementations are provided for most of the methods.
Subclasses must implement the create()
method; for
efficiency reasons, they may also override the newColl(Collection)
method.
Various set factories are available in the class SetFacts
.
Constructor Summary | |
---|---|
SetFactory()
|
Method Summary | |
---|---|
java.util.Set<T> |
create(java.util.Set<T> s)
Default implementation: invokes newColl(Collection) . |
java.util.Collection<T> |
newColl()
Default implementation: invokes Factory.create() . |
java.util.Set<T> |
newColl(java.util.Collection<T> coll)
Default implementation: uses create() to create
an empty set, and next adds all elements from
coll to the newly-created set. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface jpaul.DataStructs.Factory |
---|
create |
Constructor Detail |
---|
public SetFactory()
Method Detail |
---|
public java.util.Set<T> create(java.util.Set<T> s)
newColl(Collection)
.
create
in interface Factory<java.util.Set<T>>
Factory.create(Object)
public java.util.Collection<T> newColl()
Factory.create()
. Yes, it
would have been more consistent to make all
create
methods invoke newColl
methods (or the other way around). Still, technical typing
aspects prevent us from doing so: create
must
return a set, so it cannot invoke a newColl
(that
returns only a collection); similarly, newColl(Collection)
cannot invoke create(Set)
.
newColl
in interface CollectionFactory<T>
public java.util.Set<T> newColl(java.util.Collection<T> coll)
create()
to create
an empty set, and next adds all elements from
coll
to the newly-created set.
newColl
in interface CollectionFactory<T>
Factory.create(Object)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |