umontreal.iro.lecuyer.collections
Class TransformingList<OE,IE>
java.lang.Object
java.util.AbstractCollection<OE>
umontreal.iro.lecuyer.collections.TransformingCollection<OE,IE>
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. |
Methods inherited from interface java.util.List |
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, retainAll, size, toArray, toArray |
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.
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>
To submit a bug or ask questions, send an e-mail to
Richard Simard.