T
- the type of elements held in this collectionpublic class LazyListX<T> extends AbstractLazyCollection<T,java.util.List<T>> implements ListX<T>
List
Extended List operations execute lazily e.g.
LazyListX<Integer> q = LazyListX.of(1,2,3)
.map(i->i*2);
The map operation above is not executed immediately. It will only be executed when (if) the data inside the
queue is accessed. This allows lazy operations to be chained and executed more efficiently e.g.
LazyListX<Integer> q = LazyListX.of(1,2,3)
.map(i->i*2);
.filter(i->i<5);
The operation above is more efficient than the equivalent operation with a ListX.ListX.µ, ListX.Instances
Constructor and Description |
---|
LazyListX(java.util.List<T> list,
ReactiveSeq<T> seq,
java.util.stream.Collector<T,?,java.util.List<T>> collector) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element) |
boolean |
addAll(int index,
java.util.Collection<? extends T> c) |
<T1> LazyListX<T1> |
from(java.util.Collection<T1> c)
Conctruct an Extended Collection from a standard Collection
|
<X> LazyListX<X> |
fromStream(ReactiveSeq<X> stream) |
T |
get(int index) |
<T1> java.util.stream.Collector<T1,?,java.util.List<T1>> |
getCollector() |
int |
indexOf(java.lang.Object o) |
java.util.Iterator<T> |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator<T> |
listIterator() |
java.util.ListIterator<T> |
listIterator(int index) |
ListX<T> |
materialize() |
T |
remove(int index) |
void |
replaceAll(java.util.function.UnaryOperator<T> operator) |
T |
set(int index,
T element) |
void |
sort(java.util.Comparator<? super T> c) |
ListX<T> |
subList(int fromIndex,
int toIndex)
Create a sub sequence between the two supplied index
|
java.lang.String |
toString() |
ListX<T> |
type(java.util.stream.Collector<T,?,java.util.List<T>> collector) |
<R> LazyListX<R> |
unit(java.util.Collection<R> col)
Create a new instance of the same colleciton type from the supplied collection
|
<U> LazyListX<U> |
unitIterator(java.util.Iterator<U> it)
Create an IterableFunctor instance of the same type from an Iterator
|
LazyListX<T> |
withCollector(java.util.stream.Collector<T,?,java.util.List<T>> collector) |
add, addAll, clear, contains, containsAll, equals, get, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, unwrap
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
anyM, append, append, cast, coflatMap, combinations, combinations, combine, combine, compareTo, cycle, cycle, cycleUntil, cycleWhile, defaultCollector, deleteBetween, distinct, drop, dropRight, dropUntil, dropWhile, empty, fill, filter, filterNot, flatMap, flatMapP, flatMapS, forEach2, forEach2, forEach3, forEach3, forEach4, forEach4, fromIterable, fromIterable, fromIterator, fromPublisher, generate, grouped, grouped, grouped, grouped, groupedStatefullyUntil, groupedUntil, groupedUntil, groupedWhile, groupedWhile, immutableCollector, insertAt, insertAtS, intersperse, iterate, liftM, limit, limitLast, limitUntil, limitWhile, listX, listXCollector, map, minus, minus, minusAll, narrow, narrowK, notNull, of, ofType, onEmpty, onEmptyGet, onEmptySwitch, onEmptyThrow, peek, permutations, plus, plus, plusAll, plusAll, plusInOrder, plusLoop, plusLoop, prepend, prepend, prependS, range, rangeLong, recover, recover, removeAll, removeAllI, removeAllS, retainAll, retainAllI, retainAllS, retry, retry, reverse, scanLeft, scanLeft, scanRight, scanRight, shuffle, shuffle, singleton, size, skip, skipLast, skipUntil, skipWhile, slice, sliding, sliding, sorted, sorted, sorted, stream, take, takeRight, takeUntil, takeWhile, trampoline, unfold, unit, with, zip, zip, zip3, zip4, zipS, zipS, zipWithIndex
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, spliterator, toArray, toArray
reduce
mapToDouble, mapToInt, mapToLong, subscribe, traversable
zip, zip3, zip4, zipP, zipP, zipWith, zipWithP, zipWithS
groupedStatefullyUntilT, groupedT, groupedUntilT, groupedWhileT, slidingT, slidingT
fixedDelay, onePer, xPer
public LazyListX(java.util.List<T> list, ReactiveSeq<T> seq, java.util.stream.Collector<T,?,java.util.List<T>> collector)
public LazyListX<T> withCollector(java.util.stream.Collector<T,?,java.util.List<T>> collector)
withCollector
in interface ListX<T>
public ListX<T> materialize()
materialize
in interface CollectionX<T>
materialize
in interface ListX<T>
materialize
in class AbstractLazyCollection<T,java.util.List<T>>
public java.lang.String toString()
toString
in class AbstractLazyCollection<T,java.util.List<T>>
public <T1> java.util.stream.Collector<T1,?,java.util.List<T1>> getCollector()
getCollector
in interface ListX<T>
public void replaceAll(java.util.function.UnaryOperator<T> operator)
replaceAll
in interface java.util.List<T>
public void sort(java.util.Comparator<? super T> c)
sort
in interface java.util.List<T>
public boolean addAll(int index, java.util.Collection<? extends T> c)
addAll
in interface java.util.List<T>
public int indexOf(java.lang.Object o)
indexOf
in interface java.util.List<T>
public int lastIndexOf(java.lang.Object o)
lastIndexOf
in interface java.util.List<T>
public java.util.ListIterator<T> listIterator()
listIterator
in interface java.util.List<T>
public java.util.ListIterator<T> listIterator(int index)
listIterator
in interface java.util.List<T>
public ListX<T> subList(int fromIndex, int toIndex)
IndexedSequenceX
subList
in interface IndexedSequenceX<T>
subList
in interface MutableSequenceX<T>
subList
in interface ListX<T>
subList
in interface java.util.List<T>
fromIndex
- Index of our sub sequence (inclusive)toIndex
- Index of our sub sequence (exclusive)public java.util.Iterator<T> iterator()
iterator
in interface CollectionX<T>
iterator
in interface java.lang.Iterable<T>
iterator
in interface java.util.Collection<T>
iterator
in interface java.util.List<T>
iterator
in class AbstractLazyCollection<T,java.util.List<T>>
public <X> LazyListX<X> fromStream(ReactiveSeq<X> stream)
fromStream
in interface LazyCollectionX<T>
fromStream
in interface ListX<T>
stream
- Create a MultableCollectionX from a Streampublic <T1> LazyListX<T1> from(java.util.Collection<T1> c)
CollectionX
public <U> LazyListX<U> unitIterator(java.util.Iterator<U> it)
Traversable
ReactiveSeq<Integer> newSeq = seq.unitIterable(myIterator);
unitIterator
in interface Traversable<T>
unitIterator
in interface ListX<T>
it
- Iterator toNested create new IterableFunctor frompublic <R> LazyListX<R> unit(java.util.Collection<R> col)
FluentCollectionX