Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Util.Collections
Class CollectionFactory  view CollectionFactory download CollectionFactory.java

java.lang.Object
  extended byUtil.Collections.CollectionFactory
Direct Known Subclasses:
Factories.SerialCollectionFactory, ListFactory, SetFactory

public abstract class CollectionFactory
extends java.lang.Object

CollectionFactory is a Collection generator. Subclasses should implement constructions of specific types of Collections. Note that since some types of Collections have implicit constraints (such as Sets, which cannot contain more than one of the same element), code which uses the classes produced by CollectionFactorys must take care not to assume more than what is guaranteed by the Collection interface.

Version:
$Id: CollectionFactory.java,v 1.1 2003/03/05 08:26:27 joewhaley Exp $

Constructor Summary
CollectionFactory()
          Creates a CollectionFactory.
 
Method Summary
 java.util.Collection makeCollection()
          Generates a new, mutable, empty Collection.
abstract  java.util.Collection makeCollection(java.util.Collection c)
          Generates a new, mutable Collection, using the elements of c as a template for its initial contents.
 java.util.Collection makeCollection(int initialCapacity)
          Generates a new, mutable, empty Collection, using initialCapacity as a hint to use for the capacity for the produced Collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionFactory

public CollectionFactory()
Creates a CollectionFactory.

Method Detail

makeCollection

public final java.util.Collection makeCollection()
Generates a new, mutable, empty Collection.


makeCollection

public java.util.Collection makeCollection(int initialCapacity)
Generates a new, mutable, empty Collection, using initialCapacity as a hint to use for the capacity for the produced Collection.


makeCollection

public abstract java.util.Collection makeCollection(java.util.Collection c)
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.