@Deprecated public abstract class BitSet<T> extends java.lang.Object implements SortedSet<T>, java.io.Serializable
BitSet
implementation.Modifier and Type | Class and Description |
---|---|
static class |
BitSet.Builder<T>
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
abstract BitSet<T> |
add(T element)
Deprecated.
Add the given element to this set, if it is not already contained.
|
abstract BitSet<T> |
addAll(java.lang.Iterable<? extends T> elements)
Deprecated.
Adds all of the given elements to this set, if not already contained.
|
<R> SortedSet<R> |
collect(PartialFunction<? super T,? extends R> partialFunction)
Deprecated.
Collects all elements that are in the domain of the given
partialFunction by mapping the elements to type R . |
static java.util.stream.Collector<java.lang.Integer,java.util.ArrayList<java.lang.Integer>,BitSet<java.lang.Integer>> |
collector()
Deprecated.
Returns a
Collector which may be used in conjunction with
Stream.collect(java.util.stream.Collector) to obtain a BitSet . |
BitSet<T> |
diff(Set<? extends T> elements)
Deprecated.
Calculates the difference between this set and another set.
|
BitSet<T> |
distinct()
Deprecated.
Returns a new version of this which contains no duplicates.
|
abstract BitSet<T> |
distinctBy(java.util.Comparator<? super T> comparator)
Deprecated.
Returns a new version of this which contains no duplicates.
|
abstract <U> BitSet<T> |
distinctBy(java.util.function.Function<? super T,? extends U> keyExtractor)
Deprecated.
Returns a new version of this which contains no duplicates.
|
abstract BitSet<T> |
drop(int n)
Deprecated.
Drops the first n elements of this or all elements, if this length < n.
|
abstract BitSet<T> |
dropRight(int n)
Deprecated.
Drops the last n elements of this or all elements, if this length < n.
|
BitSet<T> |
dropUntil(java.util.function.Predicate<? super T> predicate)
Deprecated.
Drops elements until the predicate holds for the current element.
|
abstract BitSet<T> |
dropWhile(java.util.function.Predicate<? super T> predicate)
Deprecated.
Drops elements while the predicate holds for the current element.
|
static BitSet<java.lang.Integer> |
empty()
Deprecated.
|
static BitSet<java.lang.Integer> |
fill(int n,
java.util.function.Supplier<java.lang.Integer> s)
Deprecated.
Returns a BitSet containing
n values supplied by a given Supplier s . |
abstract BitSet<T> |
filter(java.util.function.Predicate<? super T> predicate)
Deprecated.
Returns a new traversable consisting of all elements which satisfy the given predicate.
|
abstract BitSet<T> |
filterNot(java.util.function.Predicate<? super T> predicate)
Deprecated.
Returns a new traversable consisting of all elements which do not satisfy the given predicate.
|
<U> SortedSet<U> |
flatMap(java.util.Comparator<? super U> comparator,
java.util.function.Function<? super T,? extends java.lang.Iterable<? extends U>> mapper)
Deprecated.
Same as
SortedSet.flatMap(Function) but using a specific comparator for values of the codomain of the given
mapper . |
<U> Set<U> |
flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends U>> mapper)
Deprecated.
FlatMaps this Traversable.
|
<U> U |
foldRight(U zero,
java.util.function.BiFunction<? super T,? super U,? extends U> f)
Deprecated.
Folds this elements from the right, starting with
zero and successively calling combine . |
abstract <C> Map<C,BitSet<T>> |
groupBy(java.util.function.Function<? super T,? extends C> classifier)
Deprecated.
Groups this elements by classifying the elements.
|
Iterator<BitSet<T>> |
grouped(int size)
Deprecated.
Groups this
Traversable into fixed size blocks. |
boolean |
hasDefiniteSize()
Deprecated.
Checks if this Traversable is known to have a finite size.
|
abstract BitSet<T> |
init()
Deprecated.
Dual of Traversable.tail(), returning all elements except the last.
|
Option<BitSet<T>> |
initOption()
Deprecated.
Dual of Traversable.tailOption(), returning all elements except the last as
Option . |
abstract BitSet<T> |
intersect(Set<? extends T> elements)
Deprecated.
Computes the intersection between this set and another set.
|
boolean |
isAsync()
Deprecated.
An
BitSet 's value is computed synchronously. |
boolean |
isLazy()
Deprecated.
An
BitSet 's value is computed eagerly. |
boolean |
isTraversableAgain()
Deprecated.
Checks if this Traversable can be repeatedly traversed.
|
T |
last()
Deprecated.
Dual of Traversable.head(), returning the last element.
|
<U> SortedSet<U> |
map(java.util.Comparator<? super U> comparator,
java.util.function.Function<? super T,? extends U> mapper)
Deprecated.
Same as
SortedSet.map(Function) but using a specific comparator for values of the codomain of the given
mapper . |
<U> Set<U> |
map(java.util.function.Function<? super T,? extends U> mapper)
Deprecated.
Maps the elements of this
Traversable to elements of a new type preserving their order, if any. |
static BitSet<java.lang.Integer> |
of(java.lang.Integer... values)
Deprecated.
|
static BitSet<java.lang.Integer> |
of(java.lang.Integer value)
Deprecated.
|
static BitSet<java.lang.Boolean> |
ofAll(boolean... elements)
Deprecated.
Creates a BitSet from boolean values.
|
static BitSet<java.lang.Byte> |
ofAll(byte... elements)
Deprecated.
Creates a BitSet from byte values.
|
static BitSet<java.lang.Character> |
ofAll(char... elements)
Deprecated.
Creates a BitSet from char values.
|
static BitSet<java.lang.Integer> |
ofAll(int... elements)
Deprecated.
Creates a BitSet from int values.
|
static BitSet<java.lang.Integer> |
ofAll(java.lang.Iterable<java.lang.Integer> values)
Deprecated.
|
static BitSet<java.lang.Long> |
ofAll(long... elements)
Deprecated.
Creates a BitSet from long values.
|
static BitSet<java.lang.Short> |
ofAll(short... elements)
Deprecated.
Creates a BitSet from short values.
|
static BitSet<java.lang.Integer> |
ofAll(java.util.stream.Stream<java.lang.Integer> javaStream)
Deprecated.
|
abstract Tuple2<BitSet<T>,BitSet<T>> |
partition(java.util.function.Predicate<? super T> predicate)
Deprecated.
Creates a partition of this
Traversable by splitting this elements in two in distinct traversables
according to a predicate. |
BitSet<T> |
peek(java.util.function.Consumer<? super T> action)
Deprecated.
Performs the given
action on the first element if this is an eager implementation. |
static BitSet<java.lang.Character> |
range(char from,
char toExclusive)
Deprecated.
|
static BitSet<java.lang.Integer> |
range(int from,
int toExclusive)
Deprecated.
Creates a BitSet of int numbers starting from
from , extending to toExclusive - 1 . |
static BitSet<java.lang.Long> |
range(long from,
long toExclusive)
Deprecated.
|
static BitSet<java.lang.Character> |
rangeBy(char from,
char toExclusive,
int step)
Deprecated.
|
static BitSet<java.lang.Integer> |
rangeBy(int from,
int toExclusive,
int step)
Deprecated.
Creates a BitSet of int numbers starting from
from , extending to toExclusive - 1 ,
with step . |
static BitSet<java.lang.Long> |
rangeBy(long from,
long toExclusive,
long step)
Deprecated.
|
static BitSet<java.lang.Character> |
rangeClosed(char from,
char toInclusive)
Deprecated.
|
static BitSet<java.lang.Integer> |
rangeClosed(int from,
int toInclusive)
Deprecated.
Creates a BitSet of int numbers starting from
from , extending to toInclusive . |
static BitSet<java.lang.Long> |
rangeClosed(long from,
long toInclusive)
Deprecated.
|
static BitSet<java.lang.Character> |
rangeClosedBy(char from,
char toInclusive,
int step)
Deprecated.
|
static BitSet<java.lang.Integer> |
rangeClosedBy(int from,
int toInclusive,
int step)
Deprecated.
Creates a BitSet of int numbers starting from
from , extending to toInclusive ,
with step . |
static BitSet<java.lang.Long> |
rangeClosedBy(long from,
long toInclusive,
long step)
Deprecated.
|
abstract BitSet<T> |
remove(T element)
Deprecated.
Removes a specific element from this set, if present.
|
abstract BitSet<T> |
removeAll(java.lang.Iterable<? extends T> elements)
Deprecated.
Removes all of the given elements from this set, if present.
|
BitSet<T> |
replace(T currentElement,
T newElement)
Deprecated.
Replaces the first occurrence (if exists) of the given currentElement with newElement.
|
BitSet<T> |
replaceAll(T currentElement,
T newElement)
Deprecated.
Replaces all occurrences of the given currentElement with newElement.
|
BitSet<T> |
retainAll(java.lang.Iterable<? extends T> elements)
Deprecated.
Keeps all occurrences of the given elements from this.
|
abstract BitSet<T> |
scan(T zero,
java.util.function.BiFunction<? super T,? super T,? extends T> operation)
Deprecated.
Computes a prefix scan of the elements of the collection.
|
<U> Set<U> |
scanLeft(U zero,
java.util.function.BiFunction<? super U,? super T,? extends U> operation)
Deprecated.
Produces a collection containing cumulative results of applying the
operator going left to right.
|
<U> Set<U> |
scanRight(U zero,
java.util.function.BiFunction<? super T,? super U,? extends U> operation)
Deprecated.
Produces a collection containing cumulative results of applying the
operator going right to left.
|
abstract Iterator<BitSet<T>> |
slideBy(java.util.function.Function<? super T,?> classifier)
Deprecated.
Slides a non-overlapping window of a variable size over this
Traversable . |
Iterator<BitSet<T>> |
sliding(int size)
Deprecated.
Slides a window of a specific
size and step size 1 over this Traversable by calling
Traversable.sliding(int, int) . |
abstract Iterator<BitSet<T>> |
sliding(int size,
int step)
Deprecated.
Slides a window of a specific
size and step size over this Traversable . |
abstract Tuple2<BitSet<T>,BitSet<T>> |
span(java.util.function.Predicate<? super T> predicate)
Deprecated.
Returns a tuple where the first element is the longest prefix of elements that satisfy the given
predicate and the second element is the remainder. |
java.lang.String |
stringPrefix()
Deprecated.
Returns the name of this Value type, which is used by toString().
|
static BitSet<java.lang.Integer> |
tabulate(int n,
java.util.function.Function<java.lang.Integer,java.lang.Integer> f)
Deprecated.
Returns a BitSet containing
n values of a given Function f
over a range of integer values from 0 to n - 1 . |
BitSet<T> |
tail()
Deprecated.
Drops the first element of a non-empty Traversable.
|
Option<BitSet<T>> |
tailOption()
Deprecated.
Drops the first element of a non-empty Traversable and returns an
Option . |
abstract BitSet<T> |
take(int n)
Deprecated.
Takes the first n elements of this or all elements, if this length < n.
|
abstract BitSet<T> |
takeRight(int n)
Deprecated.
Takes the last n elements of this or all elements, if this length < n.
|
BitSet<T> |
takeUntil(java.util.function.Predicate<? super T> predicate)
Deprecated.
Takes elements until the predicate holds for the current element.
|
abstract BitSet<T> |
takeWhile(java.util.function.Predicate<? super T> predicate)
Deprecated.
Takes elements while the predicate holds for the current element.
|
java.util.SortedSet<T> |
toJavaSet()
Deprecated.
Converts this Vavr
Set to a java.util.Set while preserving characteristics
like insertion order (LinkedHashSet ) and sort order (SortedSet ). |
<U> U |
transform(java.util.function.Function<? super BitSet<T>,? extends U> f)
Deprecated.
Transforms this
BitSet . |
BitSet<T> |
union(Set<? extends T> elements)
Deprecated.
Adds all of the elements of
that set to this set, if not already present. |
static BitSet.Builder<java.lang.Byte> |
withBytes()
Deprecated.
|
static BitSet.Builder<java.lang.Character> |
withCharacters()
Deprecated.
|
static <T extends java.lang.Enum<T>> |
withEnum(java.lang.Class<T> enumClass)
Deprecated.
|
static BitSet.Builder<java.lang.Long> |
withLongs()
Deprecated.
|
static <T> BitSet.Builder<T> |
withRelations(Function1<java.lang.Integer,T> fromInt,
Function1<T,java.lang.Integer> toInt)
Deprecated.
|
static BitSet.Builder<java.lang.Short> |
withShorts()
Deprecated.
|
<U> TreeSet<Tuple2<T,U>> |
zip(java.lang.Iterable<? extends U> that)
Deprecated.
Returns a traversable formed from this traversable and another Iterable collection by combining
corresponding elements in pairs.
|
<U> TreeSet<Tuple2<T,U>> |
zipAll(java.lang.Iterable<? extends U> that,
T thisElem,
U thatElem)
Deprecated.
Returns a traversable formed from this traversable and another Iterable by combining corresponding elements in
pairs.
|
<U,R> TreeSet<R> |
zipWith(java.lang.Iterable<? extends U> that,
java.util.function.BiFunction<? super T,? super U,? extends R> mapper)
Deprecated.
Returns a traversable formed from this traversable and another Iterable collection by mapping elements.
|
TreeSet<Tuple2<T,java.lang.Integer>> |
zipWithIndex()
Deprecated.
Zips this traversable with its indices.
|
<U> TreeSet<U> |
zipWithIndex(java.util.function.BiFunction<? super T,? super java.lang.Integer,? extends U> mapper)
Deprecated.
Returns a traversable formed from this traversable and another Iterable collection by mapping elements.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
contains, isDistinct, iterator, length, narrow
arrangeBy, average, containsAll, count, equals, existsUnique, find, findLast, fold, foldLeft, forEachWithIndex, get, hashCode, head, headOption, isEmpty, isSequential, isSingleValued, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkCharSeq, mkCharSeq, mkCharSeq, mkString, mkString, mkString, narrow, nonEmpty, product, reduce, reduceLeft, reduceLeftOption, reduceOption, reduceRight, reduceRightOption, single, singleOption, size, spliterator, sum, toLinkedMap, toMap, toSortedMap, toSortedMap, unzip, unzip3
collect, collect, corresponds, eq, exists, forAll, forEach, getOrElse, getOrElse, getOrElseThrow, getOrElseTry, getOrNull, narrow, out, out, stderr, stdout, toArray, toCharSeq, toCompletableFuture, toEither, toEither, toInvalid, toInvalid, toJavaArray, toJavaArray, toJavaArray, toJavaCollection, toJavaList, toJavaList, toJavaMap, toJavaMap, toJavaMap, toJavaOptional, toJavaParallelStream, toJavaSet, toJavaStream, toLeft, toLeft, toLinkedMap, toLinkedMap, toLinkedSet, toList, toMap, toMap, toOption, toPriorityQueue, toPriorityQueue, toQueue, toRight, toRight, toSet, toSortedMap, toSortedMap, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toStream, toString, toTree, toTree, toTry, toTry, toValid, toValid, toValidation, toValidation, toVector
comparator
public static <T> BitSet.Builder<T> withRelations(Function1<java.lang.Integer,T> fromInt, Function1<T,java.lang.Integer> toInt)
public static <T extends java.lang.Enum<T>> BitSet.Builder<T> withEnum(java.lang.Class<T> enumClass)
public static BitSet.Builder<java.lang.Character> withCharacters()
public static BitSet.Builder<java.lang.Byte> withBytes()
public static BitSet.Builder<java.lang.Long> withLongs()
public static BitSet.Builder<java.lang.Short> withShorts()
public static java.util.stream.Collector<java.lang.Integer,java.util.ArrayList<java.lang.Integer>,BitSet<java.lang.Integer>> collector()
Collector
which may be used in conjunction with
Stream.collect(java.util.stream.Collector)
to obtain a BitSet
.BitSet
Collector.public static BitSet<java.lang.Integer> empty()
public static BitSet<java.lang.Integer> of(java.lang.Integer value)
public static BitSet<java.lang.Integer> of(java.lang.Integer... values)
public static BitSet<java.lang.Integer> tabulate(int n, java.util.function.Function<java.lang.Integer,java.lang.Integer> f)
n
values of a given Function f
over a range of integer values from 0 to n - 1
.n
- The number of elements in the BitSetf
- The Function computing element valuesf(0),f(1), ..., f(n - 1)
java.lang.NullPointerException
- if f
is nullpublic static BitSet<java.lang.Integer> fill(int n, java.util.function.Supplier<java.lang.Integer> s)
n
values supplied by a given Supplier s
.n
- The number of elements in the BitSets
- The Supplier computing element valuesn
, where each element contains the result supplied by s
.java.lang.NullPointerException
- if s
is nullpublic static BitSet<java.lang.Integer> ofAll(java.lang.Iterable<java.lang.Integer> values)
public static BitSet<java.lang.Integer> ofAll(java.util.stream.Stream<java.lang.Integer> javaStream)
public static BitSet<java.lang.Boolean> ofAll(boolean... elements)
elements
- boolean valuesjava.lang.NullPointerException
- if elements is nullpublic static BitSet<java.lang.Byte> ofAll(byte... elements)
elements
- byte valuesjava.lang.NullPointerException
- if elements is nullpublic static BitSet<java.lang.Character> ofAll(char... elements)
elements
- char valuesjava.lang.NullPointerException
- if elements is nullpublic static BitSet<java.lang.Integer> ofAll(int... elements)
elements
- int valuesjava.lang.NullPointerException
- if elements is nullpublic static BitSet<java.lang.Long> ofAll(long... elements)
elements
- long valuesjava.lang.NullPointerException
- if elements is nullpublic static BitSet<java.lang.Short> ofAll(short... elements)
elements
- short valuesjava.lang.NullPointerException
- if elements is nullpublic static BitSet<java.lang.Integer> range(int from, int toExclusive)
from
, extending to toExclusive - 1
.from
- the first numbertoExclusive
- the last number + 1from >= toExclusive
public static BitSet<java.lang.Character> range(char from, char toExclusive)
public static BitSet<java.lang.Long> range(long from, long toExclusive)
public static BitSet<java.lang.Integer> rangeBy(int from, int toExclusive, int step)
from
, extending to toExclusive - 1
,
with step
.from
- the first numbertoExclusive
- the last number + 1step
- the stepfrom >= toInclusive
and step > 0
orfrom <= toInclusive
and step < 0
java.lang.IllegalArgumentException
- if step
is zeropublic static BitSet<java.lang.Character> rangeBy(char from, char toExclusive, int step)
public static BitSet<java.lang.Long> rangeBy(long from, long toExclusive, long step)
public static BitSet<java.lang.Integer> rangeClosed(int from, int toInclusive)
from
, extending to toInclusive
.from
- the first numbertoInclusive
- the last numberfrom > toInclusive
public static BitSet<java.lang.Character> rangeClosed(char from, char toInclusive)
public static BitSet<java.lang.Long> rangeClosed(long from, long toInclusive)
public static BitSet<java.lang.Integer> rangeClosedBy(int from, int toInclusive, int step)
from
, extending to toInclusive
,
with step
.from
- the first numbertoInclusive
- the last numberstep
- the stepfrom > toInclusive
and step > 0
orfrom < toInclusive
and step < 0
java.lang.IllegalArgumentException
- if step
is zeropublic static BitSet<java.lang.Character> rangeClosedBy(char from, char toInclusive, int step)
public static BitSet<java.lang.Long> rangeClosedBy(long from, long toInclusive, long step)
public abstract BitSet<T> add(T element)
Set
public abstract BitSet<T> addAll(java.lang.Iterable<? extends T> elements)
Set
public final <R> SortedSet<R> collect(PartialFunction<? super T,? extends R> partialFunction)
Traversable
partialFunction
by mapping the elements to type R
.
More specifically, for each of this elements in iteration order first it is checked
partialFunction.isDefinedAt(element)
If the elements makes it through that filter, the mapped instance is added to the result collection
R newElement = partialFunction.apply(element)
Note:If this Traversable
is ordered (i.e. extends Ordered
,
the caller of collect
has to ensure that the elements are comparable (i.e. extend Comparable
).collect
in interface Set<T>
collect
in interface SortedSet<T>
collect
in interface Traversable<T>
R
- The new element typepartialFunction
- A function that is not necessarily defined of all elements of this traversable.Traversable
instance containing elements of type R
public final BitSet<T> diff(Set<? extends T> elements)
Set
See also Set.removeAll(Iterable)
.
public final BitSet<T> distinct()
Traversable
equals
.public abstract BitSet<T> distinctBy(java.util.Comparator<? super T> comparator)
Traversable
comparator
.distinctBy
in interface Set<T>
distinctBy
in interface SortedSet<T>
distinctBy
in interface Traversable<T>
comparator
- A comparatorTraversable
containing this elements without duplicatespublic abstract <U> BitSet<T> distinctBy(java.util.function.Function<? super T,? extends U> keyExtractor)
Traversable
equals
.
The elements of the result are determined in the order of their occurrence - first match wins.
distinctBy
in interface Set<T>
distinctBy
in interface SortedSet<T>
distinctBy
in interface Traversable<T>
U
- key typekeyExtractor
- A key extractorTraversable
containing this elements without duplicatespublic abstract BitSet<T> drop(int n)
Traversable
drop
in interface Set<T>
drop
in interface SortedSet<T>
drop
in interface Traversable<T>
n
- The number of elements to drop.public abstract BitSet<T> dropRight(int n)
Traversable
dropRight
in interface Set<T>
dropRight
in interface SortedSet<T>
dropRight
in interface Traversable<T>
n
- The number of elements to drop.public final BitSet<T> dropUntil(java.util.function.Predicate<? super T> predicate)
Traversable
dropUntil
in interface Set<T>
dropUntil
in interface SortedSet<T>
dropUntil
in interface Traversable<T>
predicate
- A condition tested subsequently for this elements.public abstract BitSet<T> dropWhile(java.util.function.Predicate<? super T> predicate)
Traversable
Note: This is essentially the same as dropUntil(predicate.negate())
.
It is intended to be used with method references, which cannot be negated directly.
dropWhile
in interface Set<T>
dropWhile
in interface SortedSet<T>
dropWhile
in interface Traversable<T>
predicate
- A condition tested subsequently for this elements.public abstract BitSet<T> filter(java.util.function.Predicate<? super T> predicate)
Traversable
public abstract BitSet<T> filterNot(java.util.function.Predicate<? super T> predicate)
Traversable
The default implementation is equivalent to
filter(predicate.negate()
public final <U> SortedSet<U> flatMap(java.util.Comparator<? super U> comparator, java.util.function.Function<? super T,? extends java.lang.Iterable<? extends U>> mapper)
SortedSet
SortedSet.flatMap(Function)
but using a specific comparator for values of the codomain of the given
mapper
.public final <U> Set<U> flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends U>> mapper)
Traversable
public final <U> U foldRight(U zero, java.util.function.BiFunction<? super T,? super U,? extends U> f)
Traversable
zero
and successively calling combine
.
Example:
// = "!cba"
List("a", "b", "c").foldRight("!", (x, xs) -> xs + x)
public abstract <C> Map<C,BitSet<T>> groupBy(java.util.function.Function<? super T,? extends C> classifier)
Traversable
groupBy
in interface Set<T>
groupBy
in interface SortedSet<T>
groupBy
in interface Traversable<T>
C
- classified class typeclassifier
- A function which classifies elements into classesTraversable.arrangeBy(Function)
public final Iterator<BitSet<T>> grouped(int size)
Traversable
Traversable
into fixed size blocks.
Let length be the length of this Iterable. Then grouped is defined as follows:
this.isEmpty()
, the resulting Iterator
is empty.size <= length
, the resulting Iterator
will contain length / size
blocks of size
size
and maybe a non-empty block of size length % size
, if there are remaining elements.size > length
, the resulting Iterator
will contain one block of size length
.
[].grouped(1) = []
[].grouped(0) throws
[].grouped(-1) throws
[1,2,3,4].grouped(2) = [[1,2],[3,4]]
[1,2,3,4,5].grouped(2) = [[1,2],[3,4],[5]]
[1,2,3,4].grouped(5) = [[1,2,3,4]]
Please note that grouped(int)
is a special case of Traversable.sliding(int, int), i.e.
grouped(size)
is the same as sliding(size, size)
.public final boolean hasDefiniteSize()
Traversable
This method should be implemented by classes only, i.e. not by interfaces.
hasDefiniteSize
in interface Traversable<T>
public abstract BitSet<T> init()
Traversable
public final Option<BitSet<T>> initOption()
Traversable
Option
.initOption
in interface Set<T>
initOption
in interface SortedSet<T>
initOption
in interface Traversable<T>
Some(traversable)
or None
if this is empty.public final boolean isAsync()
BitSet
's value is computed synchronously.public final boolean isTraversableAgain()
Traversable
This method should be implemented by classes only, i.e. not by interfaces.
isTraversableAgain
in interface Traversable<T>
public final boolean isLazy()
BitSet
's value is computed eagerly.public abstract BitSet<T> intersect(Set<? extends T> elements)
Set
See also Set.retainAll(Iterable)
.
public final T last()
Traversable
last
in interface Traversable<T>
public abstract Tuple2<BitSet<T>,BitSet<T>> partition(java.util.function.Predicate<? super T> predicate)
Traversable
Traversable
by splitting this elements in two in distinct traversables
according to a predicate.partition
in interface Set<T>
partition
in interface SortedSet<T>
partition
in interface Traversable<T>
predicate
- A predicate which classifies an element if it is in the first or the second traversable.Traversable
contains all elements that satisfy the given predicate
, the second Traversable
contains all elements that don't. The original order of elements is preserved.public final BitSet<T> peek(java.util.function.Consumer<? super T> action)
Value
action
on the first element if this is an eager implementation.
Performs the given action
on all elements (the first immediately, successive deferred),
if this is a lazy implementation.public final java.lang.String stringPrefix()
Value
stringPrefix
in interface Value<T>
public final <U> SortedSet<U> map(java.util.Comparator<? super U> comparator, java.util.function.Function<? super T,? extends U> mapper)
SortedSet
SortedSet.map(Function)
but using a specific comparator for values of the codomain of the given
mapper
.public final <U> Set<U> map(java.util.function.Function<? super T,? extends U> mapper)
Traversable
Traversable
to elements of a new type preserving their order, if any.public abstract BitSet<T> remove(T element)
Set
public abstract BitSet<T> removeAll(java.lang.Iterable<? extends T> elements)
Set
public final BitSet<T> replace(T currentElement, T newElement)
Traversable
replace
in interface Set<T>
replace
in interface SortedSet<T>
replace
in interface Traversable<T>
currentElement
- An element to be substituted.newElement
- A replacement for currentElement.public final BitSet<T> replaceAll(T currentElement, T newElement)
Traversable
replaceAll
in interface Set<T>
replaceAll
in interface SortedSet<T>
replaceAll
in interface Traversable<T>
currentElement
- An element to be substituted.newElement
- A replacement for currentElement.public final BitSet<T> retainAll(java.lang.Iterable<? extends T> elements)
Traversable
public abstract BitSet<T> scan(T zero, java.util.function.BiFunction<? super T,? super T,? extends T> operation)
Traversable
scan
in interface Set<T>
scan
in interface SortedSet<T>
scan
in interface Traversable<T>
zero
- neutral element for the operator opoperation
- the associative operator for the scanpublic final <U> Set<U> scanLeft(U zero, java.util.function.BiFunction<? super U,? super T,? extends U> operation)
Traversable
scanLeft
in interface Set<T>
scanLeft
in interface SortedSet<T>
scanLeft
in interface Traversable<T>
U
- the type of the elements in the resulting collectionzero
- the initial valueoperation
- the binary operator applied to the intermediate result and the elementpublic final <U> Set<U> scanRight(U zero, java.util.function.BiFunction<? super T,? super U,? extends U> operation)
Traversable
scanRight
in interface Set<T>
scanRight
in interface SortedSet<T>
scanRight
in interface Traversable<T>
U
- the type of the elements in the resulting collectionzero
- the initial valueoperation
- the binary operator applied to the intermediate result and the elementpublic abstract Iterator<BitSet<T>> slideBy(java.util.function.Function<? super T,?> classifier)
Traversable
Traversable
.
Each window contains elements with the same class, as determined by classifier
. Two consecutive
values in this Traversable
will be in the same window only if classifier
returns equal
values for them. Otherwise, the values will constitute the last element of the previous window and the
first element of the next window.
Examples:
[].slideBy(Function.identity()) = []
[1,2,3,4,4,5].slideBy(Function.identity()) = [[1],[2],[3],[4,4],[5]]
[1,2,3,10,12,5,7,20,29].slideBy(x -> x/10) = [[1,2,3],[10,12],[5,7],[20,29]]
public final Iterator<BitSet<T>> sliding(int size)
Traversable
size
and step size 1 over this Traversable
by calling
Traversable.sliding(int, int)
.public abstract Iterator<BitSet<T>> sliding(int size, int step)
Traversable
size
and step
size over this Traversable
.
Examples:
[].sliding(1,1) = []
[1,2,3,4,5].sliding(2,3) = [[1,2],[4,5]]
[1,2,3,4,5].sliding(2,4) = [[1,2],[5]]
[1,2,3,4,5].sliding(2,5) = [[1,2]]
[1,2,3,4].sliding(5,3) = [[1,2,3,4]]
public abstract Tuple2<BitSet<T>,BitSet<T>> span(java.util.function.Predicate<? super T> predicate)
Traversable
predicate
and the second element is the remainder.public final BitSet<T> tail()
Traversable
public final Option<BitSet<T>> tailOption()
Traversable
Option
.tailOption
in interface Set<T>
tailOption
in interface SortedSet<T>
tailOption
in interface Traversable<T>
Some(traversable)
or None
if this is empty.public abstract BitSet<T> take(int n)
Traversable
The result is equivalent to sublist(0, max(0, min(length(), n)))
but does not throw if n < 0
or
n > length()
.
In the case of n < 0
the empty instance is returned, in the case of n > length()
this is returned.
public abstract BitSet<T> takeRight(int n)
Traversable
The result is equivalent to sublist(max(0, min(length(), length() - n)), n)
, i.e. takeRight will not
throw if n < 0
or n > length()
.
In the case of n < 0
the empty instance is returned, in the case of n > length()
this is returned.
takeRight
in interface Set<T>
takeRight
in interface SortedSet<T>
takeRight
in interface Traversable<T>
n
- The number of elements to take.public final BitSet<T> takeUntil(java.util.function.Predicate<? super T> predicate)
Traversable
Note: This is essentially the same as takeWhile(predicate.negate())
. It is intended to be used with
method references, which cannot be negated directly.
takeUntil
in interface Set<T>
takeUntil
in interface SortedSet<T>
takeUntil
in interface Traversable<T>
predicate
- A condition tested subsequently for this elements.public abstract BitSet<T> takeWhile(java.util.function.Predicate<? super T> predicate)
Traversable
takeWhile
in interface Set<T>
takeWhile
in interface SortedSet<T>
takeWhile
in interface Traversable<T>
predicate
- A condition tested subsequently for the contained elements.public final java.util.SortedSet<T> toJavaSet()
Set
Set
to a java.util.Set
while preserving characteristics
like insertion order (LinkedHashSet
) and sort order (SortedSet
).public final <U> U transform(java.util.function.Function<? super BitSet<T>,? extends U> f)
BitSet
.U
- Type of transformation resultf
- A transformationU
java.lang.NullPointerException
- if f
is nullpublic final BitSet<T> union(Set<? extends T> elements)
Set
that
set to this set, if not already present.
See also Set.addAll(Iterable)
.
public final <U> TreeSet<Tuple2<T,U>> zip(java.lang.Iterable<? extends U> that)
Traversable
The length of the returned traversable is the minimum of the lengths of this traversable and that
iterable.
zip
in interface Set<T>
zip
in interface SortedSet<T>
zip
in interface Traversable<T>
U
- The type of the second half of the returned pairs.that
- The Iterable providing the second half of each result pair.that
iterable.public final <U,R> TreeSet<R> zipWith(java.lang.Iterable<? extends U> that, java.util.function.BiFunction<? super T,? super U,? extends R> mapper)
Traversable
The length of the returned traversable is the minimum of the lengths of this traversable and that
iterable.
zipWith
in interface Set<T>
zipWith
in interface SortedSet<T>
zipWith
in interface Traversable<T>
U
- The type of the second parameter of the mapper.R
- The type of the mapped elements.that
- The Iterable providing the second parameter of the mapper.mapper
- a mapper.that
iterable.public final <U> TreeSet<Tuple2<T,U>> zipAll(java.lang.Iterable<? extends U> that, T thisElem, U thatElem)
Traversable
The length of the returned traversable is the maximum of the lengths of this traversable and that
iterable.
Special case: if this traversable is shorter than that elements, and that elements contains duplicates, the resulting traversable may be shorter than the maximum of the lengths of this and that because a traversable contains an element at most once.
If this Traversable is shorter than that, thisElem values are used to fill the result. If that is shorter than this Traversable, thatElem values are used to fill the result.
zipAll
in interface Set<T>
zipAll
in interface SortedSet<T>
zipAll
in interface Traversable<T>
U
- The type of the second half of the returned pairs.that
- The Iterable providing the second half of each result pair.thisElem
- The element to be used to fill up the result if this traversable is shorter than that.thatElem
- The element to be used to fill up the result if that is shorter than this traversable.public final TreeSet<Tuple2<T,java.lang.Integer>> zipWithIndex()
Traversable
zipWithIndex
in interface Set<T>
zipWithIndex
in interface SortedSet<T>
zipWithIndex
in interface Traversable<T>
public final <U> TreeSet<U> zipWithIndex(java.util.function.BiFunction<? super T,? super java.lang.Integer,? extends U> mapper)
Traversable
The length of the returned traversable is the minimum of the lengths of this traversable and that
iterable.
zipWithIndex
in interface Set<T>
zipWithIndex
in interface SortedSet<T>
zipWithIndex
in interface Traversable<T>
U
- The type of the mapped elements.mapper
- a mapper.that
iterable.