T
- the type of elements held in this collectionpublic class LazyPBagX<T> extends AbstractLazyPersistentCollection<T,org.pcollections.PBag<T>> implements BagX<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.list, seq
Constructor and Description |
---|
LazyPBagX(org.pcollections.PBag<T> list) |
LazyPBagX(org.pcollections.PBag<T> list,
ReactiveSeq<T> seq) |
LazyPBagX(org.pcollections.PBag<T> list,
ReactiveSeq<T> seq,
Reducer<org.pcollections.PBag<T>> reducer) |
LazyPBagX(ReactiveSeq<T> seq) |
Modifier and Type | Method and Description |
---|---|
<T1> LazyPBagX<T1> |
from(java.util.Collection<T1> c)
Conctruct an Extended Collection from a standard Collection
|
<X> LazyPBagX<X> |
fromStream(ReactiveSeq<X> stream) |
BagX<T> |
materialize() |
BagX<T> |
minus(java.lang.Object remove)
Remove the specified element from this collection
|
BagX<T> |
minusAll(java.util.Collection<?> list)
Remove all the specified elements from this collection
|
BagX<T> |
plus(T e)
Add an element to this Collection
|
BagX<T> |
plusAll(java.util.Collection<? extends T> list)
Add all supplied elements to this Collection
|
BagX<T> |
plusLoop(int max,
java.util.function.IntFunction<T> value) |
BagX<T> |
plusLoop(java.util.function.Supplier<java.util.Optional<T>> supplier) |
BagX<T> |
type(Reducer<? extends org.pcollections.PBag<T>> reducer) |
<R> LazyPBagX<R> |
unit(java.util.Collection<R> col)
Create a new instance of the same colleciton type from the supplied collection
|
<U> LazyPBagX<U> |
unitIterator(java.util.Iterator<U> it)
Create an IterableFunctor instance of the same type from an Iterator
|
add, addAll, clear, contains, containsAll, equals, get, hashCode, isEmpty, iterator, materializeList, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toString, unwrap
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
anyM, append, append, bagX, cast, coflatMap, combinations, combinations, combine, combine, 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, insertAt, insertAtS, intersperse, iterate, limit, limitLast, limitUntil, limitWhile, map, monoid, narrow, notNull, of, ofType, onEmpty, onEmptyGet, onEmptySwitch, onEmptyThrow, permutations, plusInOrder, prepend, prepend, prependS, 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, stream, take, takeRight, takeUntil, takeWhile, trampoline, unfold, unit, zip, zip, zip3, zip4, zipS, zipS, zipWithIndex
add, addAll, clear, remove, removeAll, retainAll
reduce
collection, findAny, findFirst, fromCollection, getAtIndex, groupBy, head, headAndTail, isEmpty, iterator, materializeReversed, peek, single, single, singleOptional
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
mapToDouble, mapToInt, mapToLong, subscribe, traversable
zip, zip3, zip4, zipP, zipP, zipWith, zipWithP, zipWithS
groupedStatefullyUntilT, groupedT, groupedUntilT, groupedWhileT, slidingT, slidingT
fixedDelay, onePer, xPer
contains, containsAll, equals, hashCode, parallelStream, removeIf, size, spliterator, toArray, toArray
unwrap, unwrapIfInstance
public LazyPBagX(org.pcollections.PBag<T> list, ReactiveSeq<T> seq)
public LazyPBagX(org.pcollections.PBag<T> list, ReactiveSeq<T> seq, Reducer<org.pcollections.PBag<T>> reducer)
public LazyPBagX(org.pcollections.PBag<T> list)
public LazyPBagX(ReactiveSeq<T> seq)
public BagX<T> plusLoop(int max, java.util.function.IntFunction<T> value)
plusLoop
in interface FluentCollectionX<T>
plusLoop
in interface BagX<T>
plusLoop
in class AbstractLazyPersistentCollection<T,org.pcollections.PBag<T>>
public BagX<T> plusLoop(java.util.function.Supplier<java.util.Optional<T>> supplier)
plusLoop
in interface FluentCollectionX<T>
plusLoop
in interface BagX<T>
plusLoop
in class AbstractLazyPersistentCollection<T,org.pcollections.PBag<T>>
public BagX<T> materialize()
materialize
in interface CollectionX<T>
materialize
in interface BagX<T>
public <X> LazyPBagX<X> fromStream(ReactiveSeq<X> stream)
fromStream
in interface LazyCollectionX<T>
fromStream
in interface BagX<T>
stream
- Create a MultableCollectionX from a Streampublic <T1> LazyPBagX<T1> from(java.util.Collection<T1> c)
CollectionX
public BagX<T> plus(T e)
FluentCollectionX
plus
in interface FluentCollectionX<T>
plus
in interface LazyCollectionX<T>
plus
in interface BagX<T>
plus
in interface org.pcollections.PBag<T>
plus
in interface org.pcollections.PCollection<T>
e
- Element to addpublic BagX<T> plusAll(java.util.Collection<? extends T> list)
FluentCollectionX
plusAll
in interface FluentCollectionX<T>
plusAll
in interface LazyCollectionX<T>
plusAll
in interface BagX<T>
plusAll
in interface org.pcollections.PBag<T>
plusAll
in interface org.pcollections.PCollection<T>
list
- of elements to addpublic BagX<T> minusAll(java.util.Collection<?> list)
FluentCollectionX
minusAll
in interface FluentCollectionX<T>
minusAll
in interface LazyCollectionX<T>
minusAll
in interface BagX<T>
minusAll
in interface org.pcollections.PBag<T>
minusAll
in interface org.pcollections.PCollection<T>
list
- of elements to removepublic BagX<T> minus(java.lang.Object remove)
FluentCollectionX
minus
in interface FluentCollectionX<T>
minus
in interface LazyCollectionX<T>
minus
in interface BagX<T>
minus
in interface org.pcollections.PBag<T>
minus
in interface org.pcollections.PCollection<T>
remove
- Element to removepublic <U> LazyPBagX<U> unitIterator(java.util.Iterator<U> it)
Traversable
ReactiveSeq<Integer> newSeq = seq.unitIterable(myIterator);
unitIterator
in interface Traversable<T>
unitIterator
in interface BagX<T>
it
- Iterator toNested create new IterableFunctor frompublic <R> LazyPBagX<R> unit(java.util.Collection<R> col)
FluentCollectionX