net.sf.mmm.util.collection.base
Class HashSetFactory

java.lang.Object
  extended by net.sf.mmm.util.collection.base.AbstractSetFactory
      extended by net.sf.mmm.util.collection.base.HashSetFactory
All Implemented Interfaces:
CollectionFactory<Set>, SetFactory

public class HashSetFactory
extends AbstractSetFactory

This is an implementation of the SetFactory interface that creates instances of HashSet.

Since:
1.0.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
static SetFactory INSTANCE
          The singleton instance.
 
Constructor Summary
HashSetFactory()
           
 
Method Summary
<E> Set<E>
create()
          This method creates a new Collection instance.
<E> Set<E>
create(int capacity)
          This method creates a new Collection instance with the given initial capacity.
 Class<HashSet> getCollectionImplementation()
          This method gets the implementation of the collection-interface used by this factory.
 
Methods inherited from class net.sf.mmm.util.collection.base.AbstractSetFactory
createGeneric, createGeneric, getCollectionInterface
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final SetFactory INSTANCE
The singleton instance.

Constructor Detail

HashSetFactory

public HashSetFactory()
Method Detail

getCollectionImplementation

public Class<HashSet> getCollectionImplementation()
This method gets the implementation of the collection-interface used by this factory.

Returns:
the Collection implementation.

create

public <E> Set<E> create()
This method creates a new Collection instance.
It is explicitly typed and respects the generic element type of the collection. Therefore the type of the Collection can NOT be bound to the generic type <COLLECTION> because of limitations in Java's generic type system. You need to work on the actual sub-interface (e.g. ListFactory) to get the proper result type.

Type Parameters:
E - the type of elements contained in the collection.
Returns:
the new collection instance.
See Also:
CollectionFactory.createGeneric()

create

public <E> Set<E> create(int capacity)
This method creates a new Collection instance with the given initial capacity.
It is explicitly typed and respects the generic element type of the collection. Therefore the type of the Collection can NOT be bound to the generic type <COLLECTION> because of limitations in Java's generic type system. You need to work on the actual sub-interface (e.g. ListFactory) to get the proper result type.

Type Parameters:
E - the type of elements contained in the collection.
Parameters:
capacity - is the initial capacity of the collection.
Returns:
the new collection instance.
See Also:
CollectionFactory.createGeneric(int)


Copyright © 2001-2010 mmm-Team. All Rights Reserved.