T
- the type of elements held in this toXpublic class LazyPVectorX<T> extends AbstractLazyPersistentCollection<T,org.pcollections.PVector<T>> implements VectorX<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.
DequeX<Integer> q = DequeX.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.VectorX.CompletableVectorX<T>, VectorX.Instances
list, seq
Constructor and Description |
---|
LazyPVectorX(org.pcollections.PVector<T> list,
ReactiveSeq<T> seq,
Reducer<org.pcollections.PVector<T>> reducer,
Evaluation strict) |
Modifier and Type | Method and Description |
---|---|
void |
add(int index,
T element) |
boolean |
addAll(int index,
java.util.Collection<? extends T> c) |
static <T> java.util.function.Function<ReactiveSeq<org.pcollections.PVector<T>>,org.pcollections.PVector<T>> |
asyncVector() |
int |
compareTo(T o) |
VectorX<T> |
eager() |
<T1> LazyPVectorX<T1> |
from(java.util.Collection<T1> c)
Conctruct an Extended Collection from a standard Collection
|
<X> LazyPVectorX<X> |
fromStream(ReactiveSeq<X> stream)
Reduce (immutable Collection) a Stream to a PVector
|
T |
get(int index) |
int |
indexOf(java.lang.Object o) |
int |
lastIndexOf(java.lang.Object o) |
VectorX<T> |
lazy() |
java.util.ListIterator<T> |
listIterator() |
java.util.ListIterator<T> |
listIterator(int index) |
VectorX<T> |
materialize() |
VectorX<T> |
minus(int i)
Remove the element at the supplied index
|
VectorX<T> |
minus(java.lang.Object remove)
Remove the specified element from this toX
|
VectorX<T> |
minusAll(java.util.Collection<?> list)
Remove all the specified elements from this toX
|
VectorX<T> |
plus(int i,
T e)
Add the supplied element at the supplied index
|
VectorX<T> |
plus(T e)
Add an element to this Collection
|
VectorX<T> |
plusAll(java.util.Collection<? extends T> list)
Add all supplied elements to this Collection
|
VectorX<T> |
plusAll(int i,
java.util.Collection<? extends T> list)
Add all of the supplied elements at the supplied index
|
VectorX<T> |
plusLoop(int max,
java.util.function.IntFunction<T> value) |
VectorX<T> |
plusLoop(java.util.function.Supplier<java.util.Optional<T>> supplier) |
T |
remove(int index) |
T |
set(int index,
T element) |
VectorX<T> |
subList(int start,
int end)
Create a sub sequence between the two supplied index
|
VectorX<T> |
type(Reducer<? extends org.pcollections.PVector<T>> reducer) |
<R> LazyPVectorX<R> |
unit(java.util.Collection<R> col)
Create a new instance of the same colleciton type from the supplied toX
|
<U> LazyPVectorX<U> |
unitIterator(java.util.Iterator<U> it)
Create an IterableFunctor instance of the same type from an Iterator
|
VectorX<T> |
with(int i,
T e)
Replace the value at the specifed index with the supplied value
|
add, addAll, clear, contains, containsAll, equals, evaluation, get, handleStrict, hashCode, isEager, isEmpty, isLazy, isMaterialized, iterator, materializeList, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toString, unwrap
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
allTypeclasses, anyM, append, append, cast, coflatMap, combinations, combinations, combine, combine, completable, coproduct, cycle, cycle, cycleUntil, cycleWhile, deleteBetween, distinct, drop, dropRight, dropUntil, dropWhile, empty, emptyUnit, fill, filter, filterNot, flatMap, flatMapP, flatMapS, forEach2, forEach2, forEach3, forEach3, forEach4, forEach4, fromIterable, fromIterator, fromPublisher, generate, grouped, grouped, grouped, grouped, groupedStatefullyUntil, groupedUntil, groupedUntil, groupedWhile, groupedWhile, head, headMaybe, insertAt, insertAtS, intersperse, iterate, kindCokleisli, kindKleisli, liftM, limit, limitLast, limitUntil, limitWhile, map, mapM, monoid, narrow, narrowK, nested, notNull, of, ofType, onEmpty, onEmptyGet, onEmptySwitch, onEmptyThrow, permutations, plusInOrder, prepend, prepend, prependS, product, range, rangeLong, recover, recover, removeAll, removeAllI, removeAllS, retainAll, retainAllI, retainAllS, retry, retry, reverse, scanLeft, scanLeft, scanRight, scanRight, shuffle, shuffle, singleton, skip, skipLast, skipUntil, skipWhile, slice, sliding, sliding, sorted, sorted, sorted, tail, tailRec, take, takeRight, takeUntil, takeWhile, trampoline, unfold, unit, vectorX, widen, widen2, zip, zip, zip, zip3, zip3, zip4, zip4, zipP, zipP, zipS, zipS, zipWith, zipWithIndex, zipWithP, zipWithS
add, addAll, clear, remove, removeAll, retainAll
add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, replaceAll, retainAll, size, sort, spliterator, toArray, toArray
intercalate
flatMapP, reduce
evaluation, findAny, findFirst, fromCollection, getAtIndex, groupBy, headAndTail, isEager, isEmpty, isLazy, isMaterialized, iterator, materializeReversed, peek, single, single, singleUnsafe, stream, takeOne, toX
asFunction, foldFuture, foldLazy, foldTry, forEach, forEach, forEach, forEach, forEach, forEachSubscribe, forEachSubscribe, forEachSubscribe, runFuture, runLazy, seq, toListX, toSetX, visit
allMatch, anyMatch, collect, collectors, commonPrefix, commonSuffix, count, count, countDistinct, countDistinct, countDistinctBy, countDistinctBy, max, maxBy, min, minBy, mode, noneMatch, sum, sumDouble, sumInt, sumLong, to, toList, toMap, toMap, toSet, toString, toString
endsWith, endsWithIterable, firstValue, foldLeft, foldLeft, foldLeft, foldLeft, foldRight, foldRight, foldRight, foldRightMapToType, get, join, join, join, mapReduce, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, startsWith, startsWithIterable, xMatch
unwrap, unwrapIfInstance, unwrapNested
public LazyPVectorX(org.pcollections.PVector<T> list, ReactiveSeq<T> seq, Reducer<org.pcollections.PVector<T>> reducer, Evaluation strict)
public static final <T> java.util.function.Function<ReactiveSeq<org.pcollections.PVector<T>>,org.pcollections.PVector<T>> asyncVector()
public VectorX<T> materialize()
materialize
in interface CollectionX<T>
materialize
in interface VectorX<T>
public <X> LazyPVectorX<X> fromStream(ReactiveSeq<X> stream)
VectorX
PVector<Integer> list = PVectors.fromStream(Stream.of(1,2,3));
//list = [1,2,3]
fromStream
in interface LazyCollectionX<T>
fromStream
in interface VectorX<T>
stream
- to convert to a PVectorpublic <T1> LazyPVectorX<T1> from(java.util.Collection<T1> c)
CollectionX
public VectorX<T> minusAll(java.util.Collection<?> list)
FluentCollectionX
minusAll
in interface FluentCollectionX<T>
minusAll
in interface IndexedSequenceX<T>
minusAll
in interface LazyCollectionX<T>
minusAll
in interface VectorX<T>
minusAll
in interface org.pcollections.PCollection<T>
minusAll
in interface org.pcollections.PSequence<T>
minusAll
in interface org.pcollections.PVector<T>
list
- of elements to removepublic VectorX<T> minus(java.lang.Object remove)
FluentCollectionX
minus
in interface FluentCollectionX<T>
minus
in interface IndexedSequenceX<T>
minus
in interface LazyCollectionX<T>
minus
in interface VectorX<T>
minus
in interface org.pcollections.PCollection<T>
minus
in interface org.pcollections.PSequence<T>
minus
in interface org.pcollections.PVector<T>
remove
- Element to removepublic VectorX<T> with(int i, T e)
IndexedSequenceX
with
in interface IndexedSequenceX<T>
with
in interface VectorX<T>
with
in interface org.pcollections.PSequence<T>
with
in interface org.pcollections.PVector<T>
i
- Index to one value ate
- Value to usepublic VectorX<T> plus(int i, T e)
IndexedSequenceX
plus
in interface IndexedSequenceX<T>
plus
in interface VectorX<T>
plus
in interface org.pcollections.PSequence<T>
plus
in interface org.pcollections.PVector<T>
i
- Index to add element ate
- Element to addpublic VectorX<T> plus(T e)
FluentCollectionX
plus
in interface FluentCollectionX<T>
plus
in interface IndexedSequenceX<T>
plus
in interface LazyCollectionX<T>
plus
in interface VectorX<T>
plus
in interface org.pcollections.PCollection<T>
plus
in interface org.pcollections.PSequence<T>
plus
in interface org.pcollections.PVector<T>
e
- Element to addpublic VectorX<T> plusAll(java.util.Collection<? extends T> list)
FluentCollectionX
plusAll
in interface FluentCollectionX<T>
plusAll
in interface IndexedSequenceX<T>
plusAll
in interface LazyCollectionX<T>
plusAll
in interface VectorX<T>
plusAll
in interface org.pcollections.PCollection<T>
plusAll
in interface org.pcollections.PSequence<T>
plusAll
in interface org.pcollections.PVector<T>
list
- of elements to addpublic VectorX<T> plusAll(int i, java.util.Collection<? extends T> list)
IndexedSequenceX
plusAll
in interface IndexedSequenceX<T>
plusAll
in interface VectorX<T>
plusAll
in interface org.pcollections.PSequence<T>
plusAll
in interface org.pcollections.PVector<T>
i
- Index to add element atlist
- Collection of elements to addpublic VectorX<T> minus(int i)
IndexedSequenceX
minus
in interface IndexedSequenceX<T>
minus
in interface VectorX<T>
minus
in interface org.pcollections.PSequence<T>
minus
in interface org.pcollections.PVector<T>
i
- Index at which to remvoe elementpublic VectorX<T> subList(int start, int end)
IndexedSequenceX
subList
in interface IndexedSequenceX<T>
subList
in interface VectorX<T>
subList
in interface java.util.List<T>
subList
in interface org.pcollections.PSequence<T>
subList
in interface org.pcollections.PVector<T>
start
- Index of our sub sequence (inclusive)end
- Index of our sub sequence (exclusive)public boolean addAll(int index, java.util.Collection<? extends T> c)
public void add(int index, T element)
public T remove(int index)
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 <U> LazyPVectorX<U> unitIterator(java.util.Iterator<U> it)
Traversable
ReactiveSeq<Integer> newSeq = seq.unitIterable(myIterator);
unitIterator
in interface Traversable<T>
unitIterator
in interface VectorX<T>
it
- Iterator to create new IterableFunctor frompublic <R> LazyPVectorX<R> unit(java.util.Collection<R> col)
FluentCollectionX
public VectorX<T> plusLoop(int max, java.util.function.IntFunction<T> value)
plusLoop
in interface FluentCollectionX<T>
plusLoop
in interface VectorX<T>
plusLoop
in class AbstractLazyPersistentCollection<T,org.pcollections.PVector<T>>