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

java.lang.Object
  extended by net.sf.mmm.util.collection.base.AbstractListFactory
      extended by net.sf.mmm.util.collection.base.ArrayListFactory
All Implemented Interfaces:
CollectionFactory<List>, ListFactory

public class ArrayListFactory
extends AbstractListFactory

This is an implementation of the ListFactory interface that creates instances of ArrayList.

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

Field Summary
static ListFactory INSTANCE
          The default instance creating an ArrayList.
 
Constructor Summary
ArrayListFactory()
           
 
Method Summary
<E> List<E>
create()
          This method creates a new Collection instance.
<E> List<E>
create(int capacity)
          This method creates a new Collection instance with the given initial capacity.
 Class<ArrayList> getCollectionImplementation()
          This method gets the implementation of the collection-interface used by this factory.
 
Methods inherited from class net.sf.mmm.util.collection.base.AbstractListFactory
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 ListFactory INSTANCE
The default instance creating an ArrayList.

Constructor Detail

ArrayListFactory

public ArrayListFactory()
Method Detail

getCollectionImplementation

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

Returns:
the Collection implementation.

create

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