JUtil

net.cscott.jutil
Class SetFactory<V>

java.lang.Object
  extended by net.cscott.jutil.CollectionFactory<V>
      extended by net.cscott.jutil.SetFactory<V>
Direct Known Subclasses:
AggregateSetFactory, BitSetFactory, PersistentSetFactory

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.

Version:
$Id: SetFactory.java,v 1.4 2006-10-30 19:58:07 cananian Exp $
Author:
Felix S. Klock II

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

SetFactory

public SetFactory()
Creates a SetFactory.

Method Detail

makeCollection

public final Set<V> makeCollection()
Description copied from class: CollectionFactory
Generates a new, mutable, empty Collection.

Overrides:
makeCollection in class CollectionFactory<V>

makeCollection

public final Set<V> makeCollection(Collection<? extends V> c)
Description copied from class: CollectionFactory
Generates a new, mutable 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.

Specified by:
makeCollection in class CollectionFactory<V>

makeCollection

public final Set<V> makeCollection(int initCapacity)
Description copied from class: CollectionFactory
Generates a new, mutable, empty Collection, using initialCapacity as a hint to use for the capacity for the produced Collection.

Overrides:
makeCollection in class CollectionFactory<V>

makeSet

public Set<V> makeSet()
Generates a new, mutable, empty Set.


makeSet

public 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.


makeSet

public 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.


JUtil

Copyright (c) 2006 C. Scott Ananian