T
- the type of elements held in this collectionpublic class LazyListX<T> extends AbstractLazyMutableCollection<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(java.util.stream.Stream<X> stream) |
T |
get(int index) |
<T1> java.util.stream.Collector<T1,?,java.util.List<T1>> |
getCollector() |
int |
indexOf(java.lang.Object o) |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator<T> |
listIterator() |
java.util.ListIterator<T> |
listIterator(int index) |
static void |
main(java.lang.String[] args) |
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
|
<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, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
anyM, append, append, cast, coflatMap, combinations, combinations, 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, fromStreamS, generate, grouped, grouped, grouped, grouped, groupedStatefullyUntil, groupedUntil, groupedUntil, groupedWhile, groupedWhile, immutableCollector, insertAt, insertAtS, intersperse, iterate, liftM, limit, limitLast, limitUntil, limitWhile, 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, removeAllS, removeAllS, removeAllS, retainAllS, retainAllS, 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, toListX, trampoline, unfold, unit, with, zip, zip, zip3, zip4, zipS, zipS, zipWithIndex
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, spliterator, toArray, toArray
reduce
mapToDouble, mapToInt, mapToLong, subscribe, traversable
zip, zip3, zip4, zipP, zipP, zipWith, zipWithP, zipWithS
futureStream, getStreamable, jdkStream, reactiveSeq, reveresedJDKStream, reveresedStream
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 AbstractLazyMutableCollection<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)
FluentSequenceX
subList
in interface FluentSequenceX<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 <X> LazyListX<X> fromStream(java.util.stream.Stream<X> stream)
fromStream
in interface MutableCollectionX<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 to create new IterableFunctor frompublic static void main(java.lang.String[] args)
public <R> LazyListX<R> unit(java.util.Collection<R> col)
FluentCollectionX