T
- the type of elements held in this collectionpublic class LazyPBagX<T> extends AbstractLazyPersistentCollection<T,org.pcollections.PBag<T>> implements PBagX<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.Fn1.µ, Fn1.FunctionalOperations<T1,R>
list, seq
Constructor and Description |
---|
LazyPBagX(org.pcollections.PBag<T> list) |
LazyPBagX(org.pcollections.PBag<T> list,
ReactiveSeq<T> seq) |
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
|
PBagX<T> |
materialize() |
PBagX<T> |
minus(java.lang.Object remove)
Remove the specified element from this collection
|
PBagX<T> |
minusAll(java.util.Collection<?> list)
Remove all the specified elements from this collection
|
PBagX<T> |
plus(T e)
Add an element to this Collection
|
PBagX<T> |
plusAll(java.util.Collection<? extends T> list)
Add all supplied elements to this Collection
|
PBagX<T> |
plusLoop(int max,
java.util.function.IntFunction<T> value) |
PBagX<T> |
plusLoop(java.util.function.Supplier<java.util.Optional<T>> supplier) |
<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, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
append, append, cast, coflatMap, combinations, combinations, 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, fromCollection, fromIterable, fromPublisher, fromStream, 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, removeAllS, removeAllS, removeAllS, retainAllS, retainAllS, 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, toPBag, toPBagX, trampoline, unfold, unit, zip, zip, zip3, zip4, zipS, zipS, zipWithIndex
add, addAll, clear, remove, removeAll, retainAll
findAny, findFirst, getAtIndex, groupBy, head, headAndTail, isEmpty, iterator, peek, single, single, singleOptional
apply, foldFuture, foldLazy, foldTry, forEach, forEach, forEach, forEach, forEach, runFuture, runLazy, seq, visit
andThen, andThen, bind, compose, functionOps, lift, lift, liftF, liftOpt, liftTry, memoize, memoize, product, reader, λ, λv
apply, applyPartially, applyPartially, curry, curry, from, toFunction
allMatch, anyMatch, avg, avgDouble, avgInt, avgLong, bitAnd, bitAndInt, bitAndLong, bitOr, bitOrInt, bitOrLong, collect, collectable, commonPrefix, commonSuffix, count, count, countDistinct, countDistinct, countDistinctBy, countDistinctBy, max, max, max, max, maxAll, maxAll, maxAll, maxAll, maxAllBy, maxAllBy, maxBy, maxBy, median, median, medianBy, medianBy, min, min, min, min, minAll, minAll, minAll, minAll, minAllBy, minAllBy, minBy, minBy, mode, modeAll, modeAllBy, modeBy, noneMatch, percentile, percentile, percentileBy, percentileBy, sum, sumDouble, sumInt, sumLong, toCollection, toList, toList, toMap, toMap, toSet, 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, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, startsWith, startsWithIterable, toConcurrentLazyCollection, toConcurrentLazyStreamable, toLazyCollection, xMatch
toDequeX, toFutureStream, toFutureStream, toListX, toMapX, toOptional, toPMapX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toStreamable, toValue
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 LazyPBagX(org.pcollections.PBag<T> list, ReactiveSeq<T> seq)
public LazyPBagX(org.pcollections.PBag<T> list)
public LazyPBagX(ReactiveSeq<T> seq)
public PBagX<T> plusLoop(int max, java.util.function.IntFunction<T> value)
plusLoop
in interface FluentCollectionX<T>
plusLoop
in interface PBagX<T>
plusLoop
in class AbstractLazyPersistentCollection<T,org.pcollections.PBag<T>>
public PBagX<T> plusLoop(java.util.function.Supplier<java.util.Optional<T>> supplier)
plusLoop
in interface FluentCollectionX<T>
plusLoop
in interface PBagX<T>
plusLoop
in class AbstractLazyPersistentCollection<T,org.pcollections.PBag<T>>
public PBagX<T> materialize()
materialize
in interface CollectionX<T>
materialize
in interface PBagX<T>
public <T1> LazyPBagX<T1> from(java.util.Collection<T1> c)
CollectionX
from
in interface CollectionX<T>
from
in interface PersistentCollectionX<T>
from
in interface PBagX<T>
c
- Collection to extendpublic PBagX<T> plus(T e)
FluentCollectionX
public PBagX<T> plusAll(java.util.Collection<? extends T> list)
FluentCollectionX
plusAll
in interface FluentCollectionX<T>
plusAll
in interface PBagX<T>
plusAll
in interface org.pcollections.PBag<T>
plusAll
in interface org.pcollections.PCollection<T>
list
- of elements to addpublic PBagX<T> minusAll(java.util.Collection<?> list)
FluentCollectionX
minusAll
in interface FluentCollectionX<T>
minusAll
in interface PBagX<T>
minusAll
in interface org.pcollections.PBag<T>
minusAll
in interface org.pcollections.PCollection<T>
list
- of elements to removepublic PBagX<T> minus(java.lang.Object remove)
FluentCollectionX
public <U> LazyPBagX<U> unitIterator(java.util.Iterator<U> it)
Traversable
ReactiveSeq<Integer> newSeq = seq.unitIterable(myIterator);
unitIterator
in interface Traversable<T>
unitIterator
in interface PBagX<T>
it
- Iterator to create new IterableFunctor frompublic <R> LazyPBagX<R> unit(java.util.Collection<R> col)
FluentCollectionX
unit
in interface FluentCollectionX<T>
unit
in interface PersistentCollectionX<T>
unit
in interface PBagX<T>
col
- Collection data to populate the new collection