ContactCenters
V. 0.9.9.

umontreal.iro.lecuyer.collections
Class TransformingList<OE,IE>

java.lang.Object
  extended by java.util.AbstractCollection<OE>
      extended by umontreal.iro.lecuyer.collections.TransformingCollection<OE,IE>
          extended by umontreal.iro.lecuyer.collections.TransformingList<OE,IE>
Type Parameters:
OE - the outer type of the elements.
IE - the inner type of the elements.
All Implemented Interfaces:
Iterable<OE>, Collection<OE>, List<OE>

public abstract class TransformingList<OE,IE>
extends TransformingCollection<OE,IE>
implements List<OE>

Represents a list that dynamically transforms the elements of another list. This class extends the transforming collection to implement the List interface.


Constructor Summary
TransformingList(List<IE> innerList)
          Constructs a new transforming list mapping the elements of the inner list innerList.
 
Method Summary
 void add(int index, OE element)
           
 boolean addAll(int index, Collection<? extends OE> c)
           
 boolean equals(Object o)
           
 OE get(int index)
           
 List<IE> getInnerCollection()
          Returns the inner list.
 int hashCode()
           
 int indexOf(Object o)
           
 int lastIndexOf(Object o)
           
 ListIterator<OE> listIterator()
           
 ListIterator<OE> listIterator(int index)
           
 OE remove(int index)
           
 OE set(int index, OE element)
           
 List<OE> subList(int fromIndex, int toIndex)
           
 TransformingList<OE,IE> tryToMakeRandomAccess()
          Attempts to make this transforming list random-accessible, i.e., supporting fast random access.
 
Methods inherited from class umontreal.iro.lecuyer.collections.TransformingCollection
add, clear, contains, convertFromInnerType, convertToInnerType, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray
 

Constructor Detail

TransformingList

public TransformingList(List<IE> innerList)
Constructs a new transforming list mapping the elements of the inner list innerList.

Parameters:
innerList - the inner list.
Throws:
NullPointerException - if innerList is null.
Method Detail

getInnerCollection

public List<IE> getInnerCollection()
Returns the inner list.

Overrides:
getInnerCollection in class TransformingCollection<OE,IE>
Returns:
the inner list.

tryToMakeRandomAccess

public TransformingList<OE,IE> tryToMakeRandomAccess()
Attempts to make this transforming list random-accessible, i.e., supporting fast random access. If the inner list implements the RandomAccess interface, this method returns a transforming list implementing RandomAccess. Otherwise, the method returns this reference.

Returns:
the transforming list, possibly random-accessible.

add

public void add(int index,
                OE element)
Specified by:
add in interface List<OE>

addAll

public boolean addAll(int index,
                      Collection<? extends OE> c)
Specified by:
addAll in interface List<OE>

get

public OE get(int index)
Specified by:
get in interface List<OE>

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List<OE>

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List<OE>

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection<OE>
Specified by:
equals in interface List<OE>
Overrides:
equals in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<OE>
Specified by:
hashCode in interface List<OE>
Overrides:
hashCode in class Object

listIterator

public ListIterator<OE> listIterator()
Specified by:
listIterator in interface List<OE>

listIterator

public ListIterator<OE> listIterator(int index)
Specified by:
listIterator in interface List<OE>

remove

public OE remove(int index)
Specified by:
remove in interface List<OE>

set

public OE set(int index,
              OE element)
Specified by:
set in interface List<OE>

subList

public List<OE> subList(int fromIndex,
                        int toIndex)
Specified by:
subList in interface List<OE>

ContactCenters
V. 0.9.9.

To submit a bug or ask questions, send an e-mail to Richard Simard.