public final class HashSet<T> extends java.lang.Object implements ImmutableSet<T>, Higher<DataWitness.hashSet,T>, java.io.Serializable
Constructor and Description |
---|
HashSet() |
Modifier and Type | Method and Description |
---|---|
HashSet<T> |
add(T value) |
HashSet<T> |
append(T append) |
HashSet<T> |
appendAll(java.lang.Iterable<? extends T> it) |
HashSet<T> |
appendAll(T... values) |
HashSet<ReactiveSeq<T>> |
combinations() |
HashSet<ReactiveSeq<T>> |
combinations(int size) |
HashSet<T> |
combine(java.util.function.BiPredicate<? super T,? super T> predicate,
java.util.function.BinaryOperator<T> op)
Combine two adjacent elements in a traversable using the supplied BinaryOperator
This is a stateful grouping and reduction operation.
|
HashSet<T> |
combine(Monoid<T> op,
java.util.function.BiPredicate<? super T,? super T> predicate)
Combine two adjacent elements in a traversable using the supplied BinaryOperator
This is a stateful grouping and reduction operation.
|
<R> HashSet<R> |
concatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> fn)
Perform a flatMap operation on this IterableX.
|
boolean |
containsValue(T value) |
HashSet<T> |
cycle(long times) |
HashSet<T> |
cycle(Monoid<T> m,
long times) |
HashSet<T> |
cycleUntil(java.util.function.Predicate<? super T> predicate) |
HashSet<T> |
cycleWhile(java.util.function.Predicate<? super T> predicate) |
HashSet<T> |
deleteBetween(int start,
int end)
Delete elements between given indexes
|
HashSet<T> |
distinct() |
HashSet<T> |
drop(long num)
assertThat(ReactiveSeq.of(4,3,6,7).drop(2).toList(),equalTo(Arrays.asList(6,7))); |
HashSet<T> |
dropRight(int num)
Generate a new Traversable that drops the specified number elements from the take of this Traversable
|
HashSet<T> |
dropUntil(java.util.function.Predicate<? super T> p)
Generate a new Traversable that drops elements from this Traversable until the predicate holds
|
HashSet<T> |
dropWhile(java.util.function.Predicate<? super T> p)
Generate a new Traversable that drops elements from this Traversable as long as the predicate holds
|
Tuple2<HashSet<T>,HashSet<T>> |
duplicate() |
static <T> HashSet<T> |
empty() |
boolean |
equals(java.lang.Object o) |
HashSet<T> |
filter(java.util.function.Predicate<? super T> predicate)
Keep only elements for which the supplied predicates hold
e.g.
|
HashSet<T> |
filterNot(java.util.function.Predicate<? super T> predicate)
Remove any elements for which the predicate holds (inverse operation to filter)
e.g.
|
<R> HashSet<R> |
flatMap(java.util.function.Function<? super T,? extends ImmutableSet<? extends R>> fn) |
<R> R |
foldLeft(R zero,
java.util.function.BiFunction<R,? super T,R> f) |
<R1,R> HashSet<R> |
forEach2(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction) |
<R1,R> HashSet<R> |
forEach2(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,java.lang.Boolean> filterFunction,
java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction) |
<R1,R2,R> HashSet<R> |
forEach3(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2,
Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction) |
<R1,R2,R> HashSet<R> |
forEach3(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2,
Function3<? super T,? super R1,? super R2,java.lang.Boolean> filterFunction,
Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction) |
<R1,R2,R3,R> |
forEach4(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2,
Function3<? super T,? super R1,? super R2,? extends java.lang.Iterable<R3>> iterable3,
Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction) |
<R1,R2,R3,R> |
forEach4(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1,
java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2,
Function3<? super T,? super R1,? super R2,? extends java.lang.Iterable<R3>> iterable3,
Function4<? super T,? super R1,? super R2,? super R3,java.lang.Boolean> filterFunction,
Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction) |
static <T> HashSet<T> |
fromIterable(java.lang.Iterable<T> it) |
static <T> HashSet<T> |
fromIterator(java.util.Iterator<T> it) |
static <T> HashSet<T> |
fromStream(java.util.stream.Stream<T> stream) |
static <T> HashSet<T> |
generate(Generator<T> s)
Deprecated.
|
static <T> HashSet<T> |
generate(java.util.function.Supplier<T> s,
int max) |
HashSet<Vector<T>> |
grouped(int groupSize)
Group elements in a Stream
|
<C extends PersistentCollection<? super T>> |
grouped(int size,
java.util.function.Supplier<C> supplier)
Group the elements of this traversable
|
HashSet<Vector<T>> |
groupedUntil(java.util.function.BiPredicate<Vector<? super T>,? super T> predicate)
Create Travesable of Lists where
each List is populated while the supplied bipredicate holds.
|
HashSet<Vector<T>> |
groupedUntil(java.util.function.Predicate<? super T> predicate)
ReactiveSeq.of(1,2,3,4,5,6)
.groupedUntil(i->i%3==0)
.toList()
.size();
//2
|
<C extends PersistentCollection<? super T>> |
groupedUntil(java.util.function.Predicate<? super T> predicate,
java.util.function.Supplier<C> factory)
Create a ReactiveSeq batched by a Collection, where each batch is populated
until the predicate holds
|
HashSet<Vector<T>> |
groupedWhile(java.util.function.Predicate<? super T> predicate)
Create a Traversable batched by List, where each batch is populated while
the predicate holds
|
<C extends PersistentCollection<? super T>> |
groupedWhile(java.util.function.Predicate<? super T> predicate,
java.util.function.Supplier<C> factory)
Create a SequenceM batched by a Collection, where each batch is populated
while the predicate holds
|
int |
hashCode() |
HashSet<T> |
insertAt(int pos,
java.lang.Iterable<? extends T> values) |
HashSet<T> |
insertAt(int pos,
T... values)
Insert data into a traversable at given position
|
HashSet<T> |
insertAt(int i,
T value) |
HashSet<T> |
insertStreamAt(int pos,
java.util.stream.Stream<T> stream)
Insert a Stream into the middle of this traversable at the specified position
|
HashSet<T> |
intersperse(T value)
Returns a Traversable with a given value interspersed between any two values.
|
boolean |
isEmpty() |
static <T> HashSet<T> |
iterate(T seed,
java.util.function.Predicate<? super T> pred,
java.util.function.UnaryOperator<T> f) |
static <T> HashSet<T> |
iterate(T seed,
java.util.function.UnaryOperator<T> f,
int max) |
java.util.Iterator<T> |
iterator() |
<R> HashSet<R> |
map(java.util.function.Function<? super T,? extends R> fn)
Transform this functor using the supplied transformation function
|
<R> HashSet<R> |
mergeMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn) |
<R> HashSet<R> |
mergeMap(int maxConcurecy,
java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn) |
java.lang.String |
mkString() |
HashSet<T> |
notNull()
Filter elements retaining only values which are not null
|
static <T> HashSet<T> |
of(T... values) |
<U> HashSet<U> |
ofType(java.lang.Class<? extends U> type)
Keep only those elements in a stream that are of a given type.
|
HashSet<T> |
onEmpty(T value)
If this Container instance is zero, create a new instance containing the provided value
|
HashSet<T> |
onEmptyGet(java.util.function.Supplier<? extends T> supplier)
If this Container instance is zero, create a new instance containing the value returned from the provided Supplier
|
HashSet<T> |
peek(java.util.function.Consumer<? super T> c)
Peek at the current value of this Transformable, without transforming it
|
HashSet<ReactiveSeq<T>> |
permutations() |
HashSet<T> |
plus(T value) |
HashSet<T> |
plusAll(java.lang.Iterable<? extends T> list) |
HashSet<T> |
prepend(T value) |
HashSet<T> |
prependAll(java.lang.Iterable<? extends T> value) |
HashSet<T> |
prependAll(T... values)
List<String> result = ReactiveSeq.of(1,2,3)
.prependAll(100,200,300)
.map(it ->it+"!!")
.collect(CyclopsCollectors.toList());
//asList("100!!","200!!","300!!","1!!","2!!","3!!")));
|
HashSet<T> |
prependStream(java.util.stream.Stream<? extends T> stream) |
static HashSet<java.lang.Integer> |
range(int start,
int end) |
static HashSet<java.lang.Integer> |
range(int start,
int step,
int end) |
static HashSet<java.lang.Long> |
rangeLong(long start,
long end) |
static HashSet<java.lang.Long> |
rangeLong(long start,
long step,
long end) |
HashSet<T> |
removeAll(java.lang.Iterable<? extends T> list)
Remove all elements in the supplied Iterable from this filterable
|
HashSet<T> |
removeAll(T... values)
Remove all supplied elements from this filterable
|
HashSet<T> |
removeAt(long pos) |
HashSet<T> |
removeFirst(java.util.function.Predicate<? super T> pred) |
HashSet<T> |
removeStream(java.util.stream.Stream<? extends T> stream)
Remove all elements in the supplied Stream from this filterable
|
HashSet<T> |
removeValue(T value) |
HashSet<T> |
retainAll(java.lang.Iterable<? extends T> it)
Retain only the supplied elements in the returned Filters
|
HashSet<T> |
retainAll(T... values)
Retain only the supplied elements in the returned Filters
|
HashSet<T> |
retainStream(java.util.stream.Stream<? extends T> stream)
Retain only the supplied elements in the returned Filters
|
HashSet<T> |
reverse() |
HashSet<T> |
scanLeft(Monoid<T> monoid)
Scan left using supplied Monoid
|
<U> HashSet<U> |
scanLeft(U seed,
java.util.function.BiFunction<? super U,? super T,? extends U> function)
Scan left
|
HashSet<T> |
scanRight(Monoid<T> monoid)
Scan right
|
<U> HashSet<U> |
scanRight(U identity,
java.util.function.BiFunction<? super T,? super U,? extends U> combiner)
Scan right
|
HashSet<T> |
shuffle() |
HashSet<T> |
shuffle(java.util.Random random) |
static <T> HashSet<T> |
singleton(T value) |
int |
size() |
HashSet<T> |
slice(long from,
long to) |
HashSet<Seq<T>> |
sliding(int windowSize)
Create a sliding view
|
HashSet<Seq<T>> |
sliding(int windowSize,
int increment)
Create a sliding view
|
HashSet<T> |
sorted()
{@code ReactiveSeq.of(4,3,6,7))
.sorted()
.toList()
//Arrays.asList(3,4,6,7)
|
HashSet<T> |
sorted(java.util.Comparator<? super T> c)
assertThat(ReactiveSeq.of(4,3,6,7).sorted((a,b) -> b-a).toList(),equalTo(Arrays.asList(7,6,4,3)));
|
<U extends java.lang.Comparable<? super U>> |
sorted(java.util.function.Function<? super T,? extends U> function) |
ReactiveSeq<T> |
stream() |
HashSet<T> |
take(long n)
{@code
ReactiveSeq.of(4,3,6,7)
.take(2)
.toList()
asList(4,3)
|
HashSet<T> |
takeRight(int num)
Generate a new Traversable that takes the specified number elements from the take of this Traversable
|
HashSet<T> |
takeUntil(java.util.function.Predicate<? super T> p)
Generate a new Traversable that takes elements from this Traversable until the predicate holds
|
HashSet<T> |
takeWhile(java.util.function.Predicate<? super T> p)
Generate a new Traversable that takes elements from this Traversable as long as the predicate holds
|
java.lang.String |
toString() |
static <U,T> HashSet<T> |
unfold(U seed,
java.util.function.Function<? super U,Option<Tuple2<T,U>>> unfolder) |
<R> HashSet<R> |
unitIterable(java.lang.Iterable<R> it) |
<R> HashSet<R> |
unitStream(java.util.stream.Stream<R> stream) |
<R1,R2> Tuple2<HashSet<R1>,HashSet<R2>> |
unzip(java.util.function.Function<? super T,Tuple2<? extends R1,? extends R2>> fn) |
static <T,U> Tuple2<HashSet<T>,HashSet<U>> |
unzip(HashSet<Tuple2<T,U>> sequence) |
HashSet<T> |
updateAt(int pos,
T value) |
<T2,R> HashSet<R> |
zip(java.util.function.BiFunction<? super T,? super T2,? extends R> fn,
org.reactivestreams.Publisher<? extends T2> publisher)
Zip (combine) this Zippable with the supplied Publisher, using the supplied combining function
|
<U> HashSet<Tuple2<T,U>> |
zip(java.lang.Iterable<? extends U> other) |
<U,R> HashSet<R> |
zip(java.lang.Iterable<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zip (combine) this Zippable with the supplied Iterable using the supplied combining function
|
<S,U> HashSet<Tuple3<T,S,U>> |
zip3(java.lang.Iterable<? extends S> second,
java.lang.Iterable<? extends U> third) |
<S,U,R> HashSet<R> |
zip3(java.lang.Iterable<? extends S> second,
java.lang.Iterable<? extends U> third,
Function3<? super T,? super S,? super U,? extends R> fn3) |
<T2,T3,T4> HashSet<Tuple4<T,T2,T3,T4>> |
zip4(java.lang.Iterable<? extends T2> second,
java.lang.Iterable<? extends T3> third,
java.lang.Iterable<? extends T4> fourth) |
<T2,T3,T4,R> |
zip4(java.lang.Iterable<? extends T2> second,
java.lang.Iterable<? extends T3> third,
java.lang.Iterable<? extends T4> fourth,
Function4<? super T,? super T2,? super T3,? super T4,? extends R> fn) |
HashSet<Tuple2<T,java.lang.Long>> |
zipWithIndex() |
<U> HashSet<Tuple2<T,U>> |
zipWithPublisher(org.reactivestreams.Publisher<? extends U> other) |
<U> HashSet<Tuple2<T,U>> |
zipWithStream(java.util.stream.Stream<? extends U> other) |
<U,R> HashSet<R> |
zipWithStream(java.util.stream.Stream<? extends U> other,
java.util.function.BiFunction<? super T,? super U,? extends R> zipper) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
onEmptySwitch, onEmptyTry, traversable
setView
asFunction, equalToIteration, foldFuture, foldLazy, foldTry, forEach, forEach, forEach, forEach, forEach, forEachSubscribe, forEachSubscribe, forEachSubscribe, runFuture, runLazy, seq, to, toHashSet
fixedDelay, insertAt, onePer, subscribe, xPer
allMatch, anyMatch, atPercentile, bankersQueue, collect, collect, collect, collect, count, countDistinct, doubleStats, elementAt, endsWith, firstValue, foldLeft, foldLeft, foldLeft, foldLeft, foldLeft, foldMap, foldMap, foldMapRight, foldRight, foldRight, foldRight, groupBy, hashSet, headOption, indexOf, indexOfSlice, intStats, iterableTo, join, join, join, lastIndexOf, lastIndexOfSlice, lazySeq, longStats, maxBy, maxBy, maximum, mean, median, minBy, minBy, minimum, mode, noneMatch, nonEmptyList, occurances, populationVariance, print, print, printErr, printOut, scheduleStream, single, single, singleOrElse, startsWith, stdDeviation, sumDouble, sumInt, sumLong, takeOne, toArray, toArray, toCollection, toHashMap, toHashMap, toList, toMap, toMap, toSet, treeSet, variance, vector, withPercentiles, xMatch
public static <T> HashSet<T> empty()
public static <T> HashSet<T> singleton(T value)
public static <T> HashSet<T> of(T... values)
public static <U,T> HashSet<T> unfold(U seed, java.util.function.Function<? super U,Option<Tuple2<T,U>>> unfolder)
public static <T> HashSet<T> iterate(T seed, java.util.function.Predicate<? super T> pred, java.util.function.UnaryOperator<T> f)
public static <T> HashSet<T> iterate(T seed, java.util.function.UnaryOperator<T> f, int max)
public static <T> HashSet<T> generate(java.util.function.Supplier<T> s, int max)
public static HashSet<java.lang.Integer> range(int start, int end)
public static HashSet<java.lang.Integer> range(int start, int step, int end)
public static HashSet<java.lang.Long> rangeLong(long start, long step, long end)
public static HashSet<java.lang.Long> rangeLong(long start, long end)
public static <T> HashSet<T> fromStream(java.util.stream.Stream<T> stream)
public static <T> HashSet<T> fromIterable(java.lang.Iterable<T> it)
public static <T> HashSet<T> fromIterator(java.util.Iterator<T> it)
public <R> HashSet<R> unitIterable(java.lang.Iterable<R> it)
unitIterable
in interface IterableX<T>
unitIterable
in interface Traversable<T>
unitIterable
in interface ImmutableSet<T>
public boolean containsValue(T value)
containsValue
in interface PersistentCollection<T>
containsValue
in interface IterableX<T>
containsValue
in interface ImmutableSet<T>
public int size()
size
in interface PersistentCollection<T>
size
in interface IterableX<T>
size
in interface ImmutableSet<T>
public HashSet<T> removeValue(T value)
removeValue
in interface PersistentCollection<T>
removeValue
in interface PersistentSet<T>
removeValue
in interface IterableX<T>
removeValue
in interface ImmutableSet<T>
public boolean isEmpty()
isEmpty
in interface PersistentCollection<T>
isEmpty
in interface IterableX<T>
isEmpty
in interface ImmutableSet<T>
public <R> HashSet<R> map(java.util.function.Function<? super T,? extends R> fn)
Transformable
of(1,2,3).map(i->i*2)
//[2,4,6]
map
in interface FilterableTransformable<T>
map
in interface Transformable<T>
map
in interface IterableX<T>
map
in interface Traversable<T>
map
in interface ImmutableSet<T>
fn
- Transformation functionpublic <R> HashSet<R> flatMap(java.util.function.Function<? super T,? extends ImmutableSet<? extends R>> fn)
flatMap
in interface ImmutableSet<T>
public <R> HashSet<R> concatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends R>> fn)
IterableX
public <R> HashSet<R> mergeMap(java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn)
public <R> HashSet<R> mergeMap(int maxConcurecy, java.util.function.Function<? super T,? extends org.reactivestreams.Publisher<? extends R>> fn)
public <R1,R2,R3,R> HashSet<R> forEach4(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2, Function3<? super T,? super R1,? super R2,? extends java.lang.Iterable<R3>> iterable3, Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
forEach4
in interface ImmutableSet<T>
public <R1,R2,R3,R> HashSet<R> forEach4(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2, Function3<? super T,? super R1,? super R2,? extends java.lang.Iterable<R3>> iterable3, Function4<? super T,? super R1,? super R2,? super R3,java.lang.Boolean> filterFunction, Function4<? super T,? super R1,? super R2,? super R3,? extends R> yieldingFunction)
forEach4
in interface ImmutableSet<T>
public <R1,R2,R> HashSet<R> forEach3(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2, Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction)
forEach3
in interface ImmutableSet<T>
public <R1,R2,R> HashSet<R> forEach3(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends java.lang.Iterable<R2>> iterable2, Function3<? super T,? super R1,? super R2,java.lang.Boolean> filterFunction, Function3<? super T,? super R1,? super R2,? extends R> yieldingFunction)
forEach3
in interface ImmutableSet<T>
public <R1,R> HashSet<R> forEach2(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
forEach2
in interface ImmutableSet<T>
public <R1,R> HashSet<R> forEach2(java.util.function.Function<? super T,? extends java.lang.Iterable<R1>> iterable1, java.util.function.BiFunction<? super T,? super R1,java.lang.Boolean> filterFunction, java.util.function.BiFunction<? super T,? super R1,? extends R> yieldingFunction)
forEach2
in interface ImmutableSet<T>
public HashSet<T> filter(java.util.function.Predicate<? super T> predicate)
Filters
of(1,2,3).filter(i->i>2);
//[3]
filter
in interface Filters<T>
filter
in interface FilterableTransformable<T>
filter
in interface IterableX<T>
filter
in interface ImmutableSet<T>
predicate
- to filter elements by, retaining matchespublic <R> HashSet<R> unitStream(java.util.stream.Stream<R> stream)
unitStream
in interface ImmutableSet<T>
public HashSet<T> plus(T value)
plus
in interface PersistentCollection<T>
plus
in interface PersistentSet<T>
plus
in interface IterableX<T>
plus
in interface ImmutableSet<T>
public HashSet<T> plusAll(java.lang.Iterable<? extends T> list)
plusAll
in interface PersistentCollection<T>
plusAll
in interface PersistentSet<T>
plusAll
in interface IterableX<T>
plusAll
in interface ImmutableSet<T>
public HashSet<T> removeAll(java.lang.Iterable<? extends T> list)
IterableFilterable
removeAll
in interface PersistentCollection<T>
removeAll
in interface PersistentSet<T>
removeAll
in interface IterableFilterable<T>
removeAll
in interface IterableX<T>
removeAll
in interface ImmutableSet<T>
list
- an Iterable of elements to removeValuepublic ReactiveSeq<T> stream()
stream
in interface Folds<T>
stream
in interface PersistentCollection<T>
stream
in interface PersistentSet<T>
stream
in interface IterableX<T>
stream
in interface Traversable<T>
stream
in interface ImmutableSet<T>
public java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public HashSet<T> take(long n)
Traversable
{@code ReactiveSeq.of(4,3,6,7) .take(2) .toList() asList(4,3)
take
in interface IterableX<T>
take
in interface Traversable<T>
take
in interface ImmutableSet<T>
n
- Elements to takepublic HashSet<T> takeWhile(java.util.function.Predicate<? super T> p)
Traversable
Seq.of(1,2,3).takeWhile(i<3);
//[1,2]
takeWhile
in interface IterableX<T>
takeWhile
in interface Traversable<T>
takeWhile
in interface ImmutableSet<T>
p
- Predicate to determine when values should be takenpublic HashSet<T> dropWhile(java.util.function.Predicate<? super T> p)
Traversable
Seq.of(1,2,3).dropWhile(i<3);
//[3]
dropWhile
in interface IterableX<T>
dropWhile
in interface Traversable<T>
dropWhile
in interface ImmutableSet<T>
p
- Predicate to determine when values should be droppedpublic HashSet<T> drop(long num)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).drop(2).toList(),equalTo(Arrays.asList(6,7)));
drop
in interface IterableX<T>
drop
in interface Traversable<T>
drop
in interface ImmutableSet<T>
num
- Number of elemenets to droppublic HashSet<T> reverse()
reverse
in interface IterableX<T>
reverse
in interface Traversable<T>
reverse
in interface ImmutableSet<T>
public <R1,R2> Tuple2<HashSet<R1>,HashSet<R2>> unzip(java.util.function.Function<? super T,Tuple2<? extends R1,? extends R2>> fn)
public HashSet<T> removeFirst(java.util.function.Predicate<? super T> pred)
removeFirst
in interface IterableX<T>
removeFirst
in interface Traversable<T>
removeFirst
in interface ImmutableSet<T>
public HashSet<T> append(T append)
append
in interface IterableX<T>
append
in interface Traversable<T>
append
in interface ImmutableSet<T>
public HashSet<T> appendAll(java.lang.Iterable<? extends T> it)
appendAll
in interface IterableX<T>
appendAll
in interface Traversable<T>
appendAll
in interface ImmutableSet<T>
public <R> R foldLeft(R zero, java.util.function.BiFunction<R,? super T,R> f)
public <U> HashSet<U> ofType(java.lang.Class<? extends U> type)
Filters
// (1, 2, 3) ReactiveSeq.of(1, "a", 2, "b",3).ofType(Integer.class)
public HashSet<T> filterNot(java.util.function.Predicate<? super T> predicate)
Filters
of(1,2,3).filter(i->i>2);
//[1,2]
filterNot
in interface Filters<T>
filterNot
in interface IterableX<T>
filterNot
in interface Traversable<T>
filterNot
in interface ImmutableSet<T>
predicate
- to filter elements by, retaining matchespublic HashSet<T> notNull()
Filters
of(1,2,null,4).nonNull();
//[1,2,4]
public HashSet<T> peek(java.util.function.Consumer<? super T> c)
Transformable
of(1,2,3).map(System.out::println)
1
2
3
peek
in interface Transformable<T>
peek
in interface IterableX<T>
peek
in interface ImmutableSet<T>
c
- Consumer that recieves each element from this Transformablepublic HashSet<T> removeStream(java.util.stream.Stream<? extends T> stream)
IterableFilterable
removeStream
in interface IterableFilterable<T>
removeStream
in interface IterableX<T>
removeStream
in interface ImmutableSet<T>
stream
- of elements to removepublic HashSet<T> retainAll(java.lang.Iterable<? extends T> it)
IterableFilterable
retainAll
in interface IterableFilterable<T>
retainAll
in interface IterableX<T>
retainAll
in interface ImmutableSet<T>
it
- Iterable of elements to retainpublic HashSet<T> retainStream(java.util.stream.Stream<? extends T> stream)
IterableFilterable
retainStream
in interface IterableFilterable<T>
retainStream
in interface IterableX<T>
retainStream
in interface ImmutableSet<T>
stream
- of elements to retainpublic HashSet<T> retainAll(T... values)
IterableFilterable
retainAll
in interface IterableFilterable<T>
retainAll
in interface IterableX<T>
retainAll
in interface ImmutableSet<T>
values
- elements to retainpublic HashSet<ReactiveSeq<T>> permutations()
permutations
in interface IterableX<T>
permutations
in interface ImmutableSet<T>
public HashSet<ReactiveSeq<T>> combinations(int size)
combinations
in interface IterableX<T>
combinations
in interface ImmutableSet<T>
public HashSet<ReactiveSeq<T>> combinations()
combinations
in interface IterableX<T>
combinations
in interface ImmutableSet<T>
public <T2,R> HashSet<R> zip(java.util.function.BiFunction<? super T,? super T2,? extends R> fn, org.reactivestreams.Publisher<? extends T2> publisher)
Zippable
public <U,R> HashSet<R> zipWithStream(java.util.stream.Stream<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
zipWithStream
in interface IterableX<T>
zipWithStream
in interface Traversable<T>
zipWithStream
in interface ImmutableSet<T>
public <U> HashSet<Tuple2<T,U>> zipWithPublisher(org.reactivestreams.Publisher<? extends U> other)
zipWithPublisher
in interface IterableX<T>
zipWithPublisher
in interface Traversable<T>
zipWithPublisher
in interface Zippable<T>
zipWithPublisher
in interface ImmutableSet<T>
public <S,U,R> HashSet<R> zip3(java.lang.Iterable<? extends S> second, java.lang.Iterable<? extends U> third, Function3<? super T,? super S,? super U,? extends R> fn3)
public <T2,T3,T4,R> HashSet<R> zip4(java.lang.Iterable<? extends T2> second, java.lang.Iterable<? extends T3> third, java.lang.Iterable<? extends T4> fourth, Function4<? super T,? super T2,? super T3,? super T4,? extends R> fn)
public HashSet<T> combine(java.util.function.BiPredicate<? super T,? super T> predicate, java.util.function.BinaryOperator<T> op)
Traversable
ReactiveSeq.of(1,1,2,3)
.combine((a, b)->a.equals(b),SemigroupK.intSum)
.listX()
//Seq(3,4)
Can be used to implement terminating lazy folds on lazy data types
ReactiveSeq.generate(this::process)
.map(data->data.isSuccess())
.combine((a,b)-> a ? false : true, (a,b) -> a|b)
.findFirst(); //terminating reduction on infinite data structure
combine
in interface IterableX<T>
combine
in interface Traversable<T>
combine
in interface ImmutableSet<T>
predicate
- Test to see if two neighbours should be joined. The first parameter to the bi-predicate is the currently
accumulated result and the second is the next elementop
- BinaryOperator to combine neighbourspublic HashSet<T> combine(Monoid<T> op, java.util.function.BiPredicate<? super T,? super T> predicate)
Traversable
ReactiveSeq.of(1,1,2,3)
.combine(Monoids.intMult,(a, b)->a.equals(b))
.listX()
//Seq(1)
Simalar to @see Traversable.combine(BiPredicate, BinaryOperator)
but differs in that the first comparison is always to the Monoid zero
This allows us to terminate with just a single valuecombine
in interface IterableX<T>
combine
in interface Traversable<T>
combine
in interface ImmutableSet<T>
op
- Monoid to combine neighbourspredicate
- Test to see if two neighbours should be joined. The first parameter to the bi-predicate is the currently
accumulated result and the second is the next elementpublic HashSet<T> cycle(long times)
cycle
in interface IterableX<T>
cycle
in interface Traversable<T>
cycle
in interface ImmutableSet<T>
public HashSet<T> cycle(Monoid<T> m, long times)
cycle
in interface IterableX<T>
cycle
in interface Traversable<T>
cycle
in interface ImmutableSet<T>
public HashSet<T> cycleWhile(java.util.function.Predicate<? super T> predicate)
cycleWhile
in interface IterableX<T>
cycleWhile
in interface Traversable<T>
cycleWhile
in interface ImmutableSet<T>
public HashSet<T> cycleUntil(java.util.function.Predicate<? super T> predicate)
cycleUntil
in interface IterableX<T>
cycleUntil
in interface Traversable<T>
cycleUntil
in interface ImmutableSet<T>
public <U,R> HashSet<R> zip(java.lang.Iterable<? extends U> other, java.util.function.BiFunction<? super T,? super U,? extends R> zipper)
Zippable
public <S,U> HashSet<Tuple3<T,S,U>> zip3(java.lang.Iterable<? extends S> second, java.lang.Iterable<? extends U> third)
public <T2,T3,T4> HashSet<Tuple4<T,T2,T3,T4>> zip4(java.lang.Iterable<? extends T2> second, java.lang.Iterable<? extends T3> third, java.lang.Iterable<? extends T4> fourth)
public HashSet<Tuple2<T,java.lang.Long>> zipWithIndex()
zipWithIndex
in interface IterableX<T>
zipWithIndex
in interface Traversable<T>
zipWithIndex
in interface ImmutableSet<T>
public HashSet<Seq<T>> sliding(int windowSize)
Traversable
sliding
in interface IterableX<T>
sliding
in interface Traversable<T>
sliding
in interface ImmutableSet<T>
public HashSet<Seq<T>> sliding(int windowSize, int increment)
Traversable
sliding
in interface IterableX<T>
sliding
in interface Traversable<T>
sliding
in interface ImmutableSet<T>
public <C extends PersistentCollection<? super T>> HashSet<C> grouped(int size, java.util.function.Supplier<C> supplier)
Traversable
ReactiveSeq.of(1,1,1,1,1,1)
.grouped(3,()->new TreeSet<>())
.toList()
.getValue(0)
.size();
//1
ReactiveSeq.of(1,2,3,4,5,6)
.grouped(3,()->new TreeSet<>())
.toList()
.getValue(0)
.size();
//3
grouped
in interface IterableX<T>
grouped
in interface Traversable<T>
grouped
in interface ImmutableSet<T>
size
- batch sizesupplier
- Collection factorypublic HashSet<Vector<T>> groupedUntil(java.util.function.Predicate<? super T> predicate)
Traversable
ReactiveSeq.of(1,2,3,4,5,6)
.groupedUntil(i->i%3==0)
.toList()
.size();
//2
groupedUntil
in interface IterableX<T>
groupedUntil
in interface Traversable<T>
groupedUntil
in interface ImmutableSet<T>
predicate
- group until predicate holdspublic HashSet<Vector<T>> groupedUntil(java.util.function.BiPredicate<Vector<? super T>,? super T> predicate)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedUntil((s,i)->s.contains(4) ? true : false)
.toList().size(),equalTo(5));
groupedUntil
in interface IterableX<T>
groupedUntil
in interface Traversable<T>
groupedUntil
in interface ImmutableSet<T>
predicate
- Window while truepublic <U> HashSet<Tuple2<T,U>> zipWithStream(java.util.stream.Stream<? extends U> other)
zipWithStream
in interface IterableX<T>
zipWithStream
in interface Traversable<T>
zipWithStream
in interface ImmutableSet<T>
public HashSet<Vector<T>> groupedWhile(java.util.function.Predicate<? super T> predicate)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedWhile(i->i%3!=0)
.toList().size(),equalTo(2));
groupedWhile
in interface IterableX<T>
groupedWhile
in interface Traversable<T>
groupedWhile
in interface ImmutableSet<T>
predicate
- Batch while predicate holds, applyHKT open next batchpublic <C extends PersistentCollection<? super T>> HashSet<C> groupedWhile(java.util.function.Predicate<? super T> predicate, java.util.function.Supplier<C> factory)
Traversable
assertThat(ReactiveSeq.of(1,2,3,4,5,6)
.groupedWhile(i->i%3!=0)
.toList()
.size(),equalTo(2));
groupedWhile
in interface IterableX<T>
groupedWhile
in interface Traversable<T>
groupedWhile
in interface ImmutableSet<T>
predicate
- Batch while predicate holds, applyHKT open next batchfactory
- Collection factorypublic <C extends PersistentCollection<? super T>> HashSet<C> groupedUntil(java.util.function.Predicate<? super T> predicate, java.util.function.Supplier<C> factory)
Traversable
ReactiveSeq.of(1,2,3,4,5,6)
.groupedUntil(i->i%3!=0)
.toList()
//2
groupedUntil
in interface IterableX<T>
groupedUntil
in interface Traversable<T>
groupedUntil
in interface ImmutableSet<T>
predicate
- Batch until predicate holds, applyHKT open next batchfactory
- Collection factorypublic HashSet<Vector<T>> grouped(int groupSize)
Traversable
List<List<Integer>> list = ReactiveSeq.of(1, 2, 3, 4, 5, 6).grouped(3).collect(CyclopsCollectors.toList());
assertThat(list.getValue(0), hasItems(1, 2, 3));
assertThat(list.getValue(1), hasItems(4, 5, 6));
grouped
in interface IterableX<T>
grouped
in interface Traversable<T>
grouped
in interface ImmutableSet<T>
groupSize
- Size of each Grouppublic HashSet<T> distinct()
distinct
in interface IterableX<T>
distinct
in interface Traversable<T>
distinct
in interface ImmutableSet<T>
public HashSet<T> scanLeft(Monoid<T> monoid)
Traversable
{@code ReactiveSeq.of("a", "b", "c") .scanLeft(Reducers.toString("")) .toList(); //asList("", "a", "ab", "abc")
scanLeft
in interface IterableX<T>
scanLeft
in interface Traversable<T>
scanLeft
in interface ImmutableSet<T>
public <U> HashSet<U> scanLeft(U seed, java.util.function.BiFunction<? super U,? super T,? extends U> function)
Traversable
ReactiveSeq.of("a", "b", "c")
.scanLeft("", String::concat)
.toList();
//[, a, ab, abc]
scanLeft
in interface IterableX<T>
scanLeft
in interface Traversable<T>
scanLeft
in interface ImmutableSet<T>
public HashSet<T> scanRight(Monoid<T> monoid)
Traversable
ReactiveSeq.of("a", "b", "c")
.scanRight(Monoid.of("", String::concat))
.toList()
//asList("", "c", "bc", "abc")
scanRight
in interface IterableX<T>
scanRight
in interface Traversable<T>
scanRight
in interface ImmutableSet<T>
public <U> HashSet<U> scanRight(U identity, java.util.function.BiFunction<? super T,? super U,? extends U> combiner)
Traversable
ReactiveSeq.of("a", "ab", "abc")
.map(str->str.length())
.scanRight(0, (t, u) -> u + t)
.toList();
//asList(0, 3, 5, 6);
scanRight
in interface IterableX<T>
scanRight
in interface Traversable<T>
scanRight
in interface ImmutableSet<T>
public HashSet<T> sorted()
Traversable
{@code ReactiveSeq.of(4,3,6,7)) .sorted() .toList() //Arrays.asList(3,4,6,7)
sorted
in interface IterableX<T>
sorted
in interface Traversable<T>
sorted
in interface ImmutableSet<T>
public HashSet<T> sorted(java.util.Comparator<? super T> c)
Traversable
assertThat(ReactiveSeq.of(4,3,6,7).sorted((a,b) -> b-a).toList(),equalTo(Arrays.asList(7,6,4,3)));
sorted
in interface IterableX<T>
sorted
in interface Traversable<T>
sorted
in interface ImmutableSet<T>
c
- Compartor to sort withpublic HashSet<T> takeUntil(java.util.function.Predicate<? super T> p)
Traversable
Seq.of(1,2,3).takeUntil(i<2);
//[1,2]
takeUntil
in interface IterableX<T>
takeUntil
in interface Traversable<T>
takeUntil
in interface ImmutableSet<T>
p
- Predicate to determine when values should be taken untilpublic HashSet<T> dropUntil(java.util.function.Predicate<? super T> p)
Traversable
Seq.of(1,2,3).dropUntil(i>2);
//[3]
dropUntil
in interface IterableX<T>
dropUntil
in interface Traversable<T>
dropUntil
in interface ImmutableSet<T>
p
- Predicate to determine when values should be droppedpublic HashSet<T> dropRight(int num)
Traversable
Seq.of(1,2,3).dropRight(2);
//[1]
dropRight
in interface IterableX<T>
dropRight
in interface Traversable<T>
dropRight
in interface ImmutableSet<T>
num
- Drop this number of elements from the take of this Traversablepublic HashSet<T> takeRight(int num)
Traversable
Seq.of(1,2,3).takeRight(2);
//[2,3]
takeRight
in interface IterableX<T>
takeRight
in interface Traversable<T>
takeRight
in interface ImmutableSet<T>
num
- Take this number of elements from the take of this Traversablepublic HashSet<T> intersperse(T value)
Traversable
ReactiveSeq.of(1, 2, 3, 4).intersperse(0)
// (1, 0, 2, 0, 3, 0, 4)
intersperse
in interface IterableX<T>
intersperse
in interface Traversable<T>
intersperse
in interface ImmutableSet<T>
public HashSet<T> shuffle()
shuffle
in interface IterableX<T>
shuffle
in interface Traversable<T>
shuffle
in interface ImmutableSet<T>
public HashSet<T> shuffle(java.util.Random random)
shuffle
in interface IterableX<T>
shuffle
in interface Traversable<T>
shuffle
in interface ImmutableSet<T>
public HashSet<T> slice(long from, long to)
slice
in interface IterableX<T>
slice
in interface Traversable<T>
slice
in interface ImmutableSet<T>
public HashSet<T> prependStream(java.util.stream.Stream<? extends T> stream)
prependStream
in interface IterableX<T>
prependStream
in interface Traversable<T>
prependStream
in interface ImmutableSet<T>
public HashSet<T> appendAll(T... values)
appendAll
in interface IterableX<T>
appendAll
in interface Traversable<T>
appendAll
in interface ImmutableSet<T>
public HashSet<T> prependAll(T... values)
Traversable
List<String> result = ReactiveSeq.of(1,2,3)
.prependAll(100,200,300)
.map(it ->it+"!!")
.collect(CyclopsCollectors.toList());
//asList("100!!","200!!","300!!","1!!","2!!","3!!")));
prependAll
in interface IterableX<T>
prependAll
in interface Traversable<T>
prependAll
in interface ImmutableSet<T>
values
- to prependAllpublic HashSet<T> deleteBetween(int start, int end)
Traversable
{@code Listresult = ReactiveSeq.of(1, 2, 3, 4, 5, 6) .deleteBetween(2, 4).map(it -> it + "!!") .collect(CyclopsCollectors.toList()); //Arrays.asList("1!!", "2!!", "5!!", "6!!")));
deleteBetween
in interface IterableX<T>
deleteBetween
in interface Traversable<T>
deleteBetween
in interface ImmutableSet<T>
start
- indexend
- indexpublic HashSet<T> insertStreamAt(int pos, java.util.stream.Stream<T> stream)
Traversable
List<String> result = ReactiveSeq.of(1, 2, 3)
.insertAt(1, of(100, 200, 300))
.map(it -> it + "!!")
.collect(CyclopsCollectors.toList());
//Arrays.asList("1!!", "100!!", "200!!", "300!!", "2!!", "3!!")));
insertStreamAt
in interface IterableX<T>
insertStreamAt
in interface Traversable<T>
insertStreamAt
in interface ImmutableSet<T>
pos
- to insert Stream atstream
- to insertpublic <U extends java.lang.Comparable<? super U>> HashSet<T> sorted(java.util.function.Function<? super T,? extends U> function)
sorted
in interface IterableX<T>
sorted
in interface Traversable<T>
sorted
in interface ImmutableSet<T>
public java.lang.String mkString()
public HashSet<T> onEmpty(T value)
OnEmpty
public HashSet<T> onEmptyGet(java.util.function.Supplier<? extends T> supplier)
OnEmpty
onEmptyGet
in interface OnEmpty<T>
onEmptyGet
in interface IterableX<T>
onEmptyGet
in interface Traversable<T>
onEmptyGet
in interface ImmutableSet<T>
supplier
- to determine new value for containerpublic HashSet<T> removeAll(T... values)
IterableFilterable
removeAll
in interface IterableFilterable<T>
removeAll
in interface IterableX<T>
removeAll
in interface ImmutableSet<T>
values
- to removeValuepublic HashSet<T> prepend(T value)
prepend
in interface IterableX<T>
prepend
in interface Traversable<T>
prepend
in interface ImmutableSet<T>
public HashSet<T> removeAt(long pos)
removeAt
in interface IterableX<T>
removeAt
in interface Traversable<T>
removeAt
in interface ImmutableSet<T>
public HashSet<T> prependAll(java.lang.Iterable<? extends T> value)
prependAll
in interface IterableX<T>
prependAll
in interface Traversable<T>
prependAll
in interface ImmutableSet<T>
public HashSet<T> updateAt(int pos, T value)
updateAt
in interface IterableX<T>
updateAt
in interface Traversable<T>
updateAt
in interface ImmutableSet<T>
public HashSet<T> insertAt(int pos, java.lang.Iterable<? extends T> values)
insertAt
in interface IterableX<T>
insertAt
in interface Traversable<T>
insertAt
in interface ImmutableSet<T>
public HashSet<T> insertAt(int pos, T... values)
Traversable
List<String> result = ReactiveSeq.of(1, 2, 3)
.insertAt(1, 100, 200, 300)
.map(it -> it + "!!")
.collect(CyclopsCollectors.toList());
//Arrays.asList("1!!", "100!!", "200!!", "300!!", "2!!", "3!!")))
insertAt
in interface IterableX<T>
insertAt
in interface Traversable<T>
insertAt
in interface ImmutableSet<T>
pos
- to insert data atvalues
- to insert