|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.AbstractCollection<E>
java.util.AbstractList<O>
ch.elca.el4j.util.collections.impl.DefaultTransformedList<I,O>
I
- the backing list's element typeO
- this list's element typepublic class DefaultTransformedList<I,O>
Default implementation of TransformedList
.
Field Summary |
---|
Fields inherited from class java.util.AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
DefaultTransformedList(List<? extends I> backing,
Function<? super I,O> function)
Constructor. |
Method Summary | ||
---|---|---|
FilteredList<O> |
filtered(Filter<? super O> filter)
Convenience method returning a filtered view on this collection. |
|
O |
get(int index)
Returns an element of this list. |
|
List<? extends I> |
getBacking()
returns the backing list. |
|
|
mapped(Function<? super O,T> function)
Convenience method returning a TransformedList view to this
list. |
|
void |
orderLike(List<? extends O> example)
Reorders this list's elements by example. |
|
int |
size()
|
|
void |
swap(int i,
int j)
exchanges the elements located at indices i and j . |
|
O[] |
toArray(Class<O> c)
|
Methods inherited from class java.util.AbstractList |
---|
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList |
Methods inherited from class java.util.AbstractCollection |
---|
addAll, contains, containsAll, isEmpty, remove, 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, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray |
Constructor Detail |
---|
public DefaultTransformedList(List<? extends I> backing, Function<? super I,O> function)
backing
- the backing listfunction
- the transformation functionMethod Detail |
---|
public O get(int index)
get
in interface List<O>
get
in class AbstractList<O>
index
- the index of the element to return
public int size()
size
in interface Collection<O>
size
in interface List<O>
size
in class AbstractCollection<O>
public void swap(int i, int j)
i
and j
.
swap
in interface ExtendedReorderableList<O>
i
- ...j
- ...public void orderLike(List<? extends O> example)
example
as far as
element equality is concerned, or throws
a NoSuchElementException
if this is not possible.
In either case, the order of the remaining elements may be affected.
This method may require quadratic time.
Formally, if this method completes normally, the condition
∀ i < example.size();
c.apply(this.get(i)).equals(example.get(i))
is true.
orderLike
in interface ExtendedReorderableList<O>
example
- a list whose elements are in the descired orderpublic O[] toArray(Class<O> c)
toArray
in interface ExtendedList<O>
c
- the element type for the new array
public <T> TransformedList<O,T> mapped(Function<? super O,T> function)
TransformedList
view to this
list.
mapped
in interface ExtendedList<O>
function
- the transformation function to apply to each element
public List<? extends I> getBacking()
getBacking
in interface TransformedList<I,O>
public FilteredList<O> filtered(Filter<? super O> filter)
filtered
in interface ExtendedList<O>
filter
- the filter deciding which elements are included
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |