net.sf.mmm.util.collection.base
Class CollectionList<E>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<E>
              extended by net.sf.mmm.util.collection.base.CollectionList<E>
Type Parameters:
E - is the generic type of the elements.
All Implemented Interfaces:
Serializable, Cloneable, Iterable<E>, Collection<E>, List<E>, RandomAccess

public class CollectionList<E>
extends ArrayList<E>

This is an implementation of the List interface that adapts another Collection as delegate.

Since:
1.0.1
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
See Also:
Serialized Form

Nested Class Summary
private  class CollectionList.ListIterator
          This inner class implements an Iterator for this CollectionList.
 
Field Summary
private  Collection<E> delegate
           
private static long serialVersionUID
          UID for serialization.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CollectionList(Collection<E> delegate)
          The constructor.
 
Method Summary
 boolean add(E element)
          
 void add(int index, E element)
          
 boolean addAll(Collection<? extends E> collection)
          
 Collection<E> getDelegate()
          This method gets the underlying Collection that is adapted to appear as List.
 Iterator<E> iterator()
          
 E remove(int index)
          
 boolean remove(Object o)
          
 E set(int index, E element)
          
 
Methods inherited from class java.util.ArrayList
addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, removeRange, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, listIterator, listIterator, removeAll, retainAll, subList
 

Field Detail

serialVersionUID

private static final long serialVersionUID
UID for serialization.

See Also:
Constant Field Values

delegate

private Collection<E> delegate
See Also:
getDelegate()
Constructor Detail

CollectionList

public CollectionList(Collection<E> delegate)
The constructor.

Parameters:
delegate - is the Collection to adapt.
Method Detail

getDelegate

public Collection<E> getDelegate()
This method gets the underlying Collection that is adapted to appear as List.

Returns:
the delegate.

set

public E set(int index,
             E element)

Specified by:
set in interface List<E>
Overrides:
set in class ArrayList<E>

add

public boolean add(E element)

Specified by:
add in interface Collection<E>
Specified by:
add in interface List<E>
Overrides:
add in class ArrayList<E>

add

public void add(int index,
                E element)

Specified by:
add in interface List<E>
Overrides:
add in class ArrayList<E>

remove

public E remove(int index)

Specified by:
remove in interface List<E>
Overrides:
remove in class ArrayList<E>

remove

public boolean remove(Object o)

Specified by:
remove in interface Collection<E>
Specified by:
remove in interface List<E>
Overrides:
remove in class ArrayList<E>

addAll

public boolean addAll(Collection<? extends E> collection)

Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface List<E>
Overrides:
addAll in class ArrayList<E>

iterator

public Iterator<E> iterator()

Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface List<E>
Overrides:
iterator in class AbstractList<E>


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