net.cscott.jutil

Class SetFactory<V>

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.2 2004/01/13 20:47:05 cananian Exp $

Author: Felix S. Klock II

Constructor Summary
SetFactory()
Creates a SetFactory.
Method Summary
Set<V>makeCollection()
Set<V>makeCollection(Collection<? extends V> c)
Set<V>makeCollection(int initCapacity)
Set<V>makeSet()
Generates a new, mutable, empty Set.
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.
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.

Constructor Detail

SetFactory

public SetFactory()
Creates a SetFactory.

Method Detail

makeCollection

public final Set<V> makeCollection()

makeCollection

public final Set<V> makeCollection(Collection<? extends V> c)

makeCollection

public final Set<V> makeCollection(int initCapacity)

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.
Copyright © 2003 C. Scott Ananian