Top Description Fields Methods
io.vavr.collection

public Interface SortedSet<T>

extends Set<T>, Ordered<T>
Known Direct Subinterfaces
io.vavr.collection.BitSet
Known Direct Implementers
io.vavr.collection.TreeSet
Type Parameters
<T>
Component type
Imports
io.vavr.PartialFunction, .Tuple3, .Tuple2, io.vavr.control.Option, java.util.Comparator, .NoSuchElementException, java.util.function.*

An immutable SortedSet interface.

Specific SortedSet operations:

Author
Daniel Dietrich

Field Summary

Modifier and TypeField and Description
public static final long

Method Summary

Modifier and TypeMethod and Description
public SortedSet<T>
add(T
The element to be added.
element
)

Redeclares io.vavr.collection.Set.add.

Add the given element to this set, if it is not already contained.

public SortedSet<T>
addAll(Iterable<? extends T>
The elements to be added.
elements
)

Redeclares io.vavr.collection.Set.addAll.

Adds all of the given elements to this set, if not already contained.

public <R> SortedSet<R>
collect(PartialFunction<? super T, ? extends R>
A function that is not necessarily defined of all elements of this traversable.
partialFunction
)

Redeclares io.vavr.collection.Set.collect.

Collects all elements that are in the domain of the given partialFunction by mapping the elements to type R.

public SortedSet<T>
diff(Set<? extends T>
Elements to be removed from this set.
elements
)

Redeclares io.vavr.collection.Set.diff.

Calculates the difference between this set and another set.

public SortedSet<T>
distinct()

Redeclares io.vavr.collection.Set.distinct.

Returns a new version of this which contains no duplicates.

public SortedSet<T>
distinctBy(Comparator<? super T>
A comparator
comparator
)

Redeclares io.vavr.collection.Set.distinctBy.

Returns a new version of this which contains no duplicates.

public <U> SortedSet<T>
distinctBy(Function<? super T, ? extends U>
A key extractor
keyExtractor
)

Redeclares io.vavr.collection.Set.distinctBy.

Returns a new version of this which contains no duplicates.

public SortedSet<T>
drop(int
The number of elements to drop.
n
)

Redeclares io.vavr.collection.Set.drop.

Drops the first n elements of this or all elements, if this length < n.

public SortedSet<T>
dropRight(int
The number of elements to drop.
n
)

Redeclares io.vavr.collection.Set.dropRight.

Drops the last n elements of this or all elements, if this length < n.

public SortedSet<T>
dropUntil(Predicate<? super T>
A condition tested subsequently for this elements.
predicate
)

Redeclares io.vavr.collection.Set.dropUntil.

Drops elements until the predicate holds for the current element.

public SortedSet<T>
dropWhile(Predicate<? super T>
A condition tested subsequently for this elements.
predicate
)

Redeclares io.vavr.collection.Set.dropWhile.

Drops elements while the predicate holds for the current element.

public SortedSet<T>
filter(Predicate<? super T>
A predicate
predicate
)

Redeclares io.vavr.collection.Set.filter.

Returns a new traversable consisting of all elements which satisfy the given predicate.

public <
Type of flat-mapped values
U
>
SortedSet<U>

Returns:

A new Set instance containing mapped values
flatMap
(Comparator<? super U>
A comparator for values of type U
comparator
,
Function<? super T, ? extends Iterable<? extends U>>
A function which maps values of type T to Iterables of values of type U
mapper
)

Same as flatMap(Function) but using a specific comparator for values of the codomain of the given mapper.

public <U> SortedSet<U>
flatMap(Function<? super T, ? extends Iterable<? extends U>>
A mapper
mapper
)

Redeclares io.vavr.collection.Set.flatMap.

FlatMaps this Traversable.

public <C> Map<C, ? extends SortedSet<T>>
groupBy(Function<? super T, ? extends C>
A function which classifies elements into classes
classifier
)

Redeclares io.vavr.collection.Set.groupBy.

Groups this elements by classifying the elements.

public Iterator<? extends SortedSet<T>>
grouped(int
a positive block size
size
)

Redeclares io.vavr.collection.Set.grouped.

Groups this Traversable into fixed size blocks.

public SortedSet<T>
init()

Redeclares io.vavr.collection.Set.init.

Dual of tail(), returning all elements except the last.

public Option<? extends SortedSet<T>>
initOption()

Redeclares io.vavr.collection.Set.initOption.

Dual of tailOption(), returning all elements except the last as Option.

public SortedSet<T>
intersect(Set<? extends T>
the set to intersect with.
elements
)

Redeclares io.vavr.collection.Set.intersect.

Computes the intersection between this set and another set.

public default boolean
isOrdered()

Overrides default io.vavr.collection.Traversable.isOrdered.

Checks if this Traversable is ordered

public <
Type of mapped values
U
>
SortedSet<U>

Returns:

A new Set instance containing mapped values
map
(Comparator<? super U>
A comparator for values of type U
comparator
,
Function<? super T, ? extends U>
A function which maps values of type T to values of type U
mapper
)

Same as map(Function) but using a specific comparator for values of the codomain of the given mapper.

public <U> SortedSet<U>
map(Function<? super T, ? extends U>
A mapper.
mapper
)

Redeclares io.vavr.collection.Set.map.

Maps the elements of this Traversable to elements of a new type preserving their order, if any.

public static <
Component type of the SortedSet.
T
>
SortedSet<T>

Returns:

the given sortedSet instance as narrowed type SortedSet<T>.
narrow
(SortedSet<? extends T>
A SortedSet.
sortedSet
)

Narrows a widened SortedSet<?

public SortedSet<T>
orElse(Iterable<? extends T>
An alternative Traversable
other
)

Redeclares io.vavr.collection.Set.orElse.

Returns this Traversable if it is nonempty, otherwise return the alternative.

public SortedSet<T>
orElse(Supplier<? extends Iterable<? extends T>>
An alternative Traversable supplier
supplier
)

Redeclares io.vavr.collection.Set.orElse.

Returns this Traversable if it is nonempty, otherwise return the result of evaluating supplier.

public Tuple2<? extends SortedSet<T>, ? extends SortedSet<T>>
partition(Predicate<? super T>
A predicate which classifies an element if it is in the first or the second traversable.
predicate
)

Redeclares io.vavr.collection.Set.partition.

Creates a partition of this Traversable by splitting this elements in two in distinct traversables according to a predicate.

public SortedSet<T>
peek(Consumer<? super T>
The action that will be performed on the element(s).
action
)

Redeclares io.vavr.collection.Set.peek.

Performs the given action on the first element if this is an eager implementation.

public SortedSet<T>
reject(Predicate<? super T>
A predicate
predicate
)

Redeclares io.vavr.collection.Set.reject.

Returns a new traversable consisting of all elements which do not satisfy the given predicate.

public SortedSet<T>
remove(T
The element to be removed from this set.
element
)

Redeclares io.vavr.collection.Set.remove.

Removes a specific element from this set, if present.

public SortedSet<T>
removeAll(Iterable<? extends T>
The elements to be removed from this set.
elements
)

Redeclares io.vavr.collection.Set.removeAll.

Removes all of the given elements from this set, if present.

public SortedSet<T>
replace(T
An element to be substituted.
currentElement
,
T
A replacement for currentElement.
newElement
)

Redeclares io.vavr.collection.Set.replace.

Replaces the first occurrence (if exists) of the given currentElement with newElement.

public SortedSet<T>
replaceAll(T
An element to be substituted.
currentElement
,
T
A replacement for currentElement.
newElement
)

Redeclares io.vavr.collection.Set.replaceAll.

Replaces all occurrences of the given currentElement with newElement.

public SortedSet<T>
retainAll(Iterable<? extends T>
Elements to be kept.
elements
)

Redeclares io.vavr.collection.Set.retainAll.

Keeps all occurrences of the given elements from this.

public SortedSet<T>
scan(T
neutral element for the operator op
zero
,
BiFunction<? super T, ? super T, ? extends T>
the associative operator for the scan
operation
)

Redeclares io.vavr.collection.Set.scan.

Computes a prefix scan of the elements of the collection.

public <U> Set<U>
scanLeft(U
the initial value
zero
,
BiFunction<? super U, ? super T, ? extends U>
the binary operator applied to the intermediate result and the element
operation
)

Redeclares io.vavr.collection.Set.scanLeft.

Produces a collection containing cumulative results of applying the operator going left to right.

public <U> Set<U>
scanRight(U
the initial value
zero
,
BiFunction<? super T, ? super U, ? extends U>
the binary operator applied to the intermediate result and the element
operation
)

Redeclares io.vavr.collection.Set.scanRight.

Produces a collection containing cumulative results of applying the operator going right to left.

public Iterator<? extends SortedSet<T>>
slideBy(Function<? super T, ?>
A function which classifies elements into classes
classifier
)

Redeclares io.vavr.collection.Set.slideBy.

Slides a non-overlapping window of a variable size over this Traversable.

public Iterator<? extends SortedSet<T>>
sliding(int
a positive window size
size
)

Redeclares io.vavr.collection.Set.sliding.

Slides a window of a specific size and step size 1 over this Traversable by calling sliding(int, int).

public Iterator<? extends SortedSet<T>>
sliding(int
a positive window size
size
,
int
a positive step size
step
)

Redeclares io.vavr.collection.Set.sliding.

Slides a window of a specific size and step size over this Traversable.

public Tuple2<? extends SortedSet<T>, ? extends SortedSet<T>>
span(Predicate<? super T>
A predicate.
predicate
)

Redeclares io.vavr.collection.Set.span.

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.

public SortedSet<T>
tail()

Redeclares io.vavr.collection.Set.tail.

Drops the first element of a non-empty Traversable.

public Option<? extends SortedSet<T>>
tailOption()

Redeclares io.vavr.collection.Set.tailOption.

Drops the first element of a non-empty Traversable and returns an Option.

public SortedSet<T>
take(int
The number of elements to take.
n
)

Redeclares io.vavr.collection.Set.take.

Takes the first n elements of this or all elements, if this length < n.

public SortedSet<T>
takeRight(int
The number of elements to take.
n
)

Redeclares io.vavr.collection.Set.takeRight.

Takes the last n elements of this or all elements, if this length < n.

public SortedSet<T>
takeUntil(Predicate<? super T>
A condition tested subsequently for this elements.
predicate
)

Redeclares io.vavr.collection.Set.takeUntil.

Takes elements until the predicate holds for the current element.

public SortedSet<T>
takeWhile(Predicate<? super T>
A condition tested subsequently for the contained elements.
predicate
)

Redeclares io.vavr.collection.Set.takeWhile.

Takes elements while the predicate holds for the current element.

public SortedSet<T>
toJavaSet()

Redeclares io.vavr.collection.Set.toJavaSet.

Converts this Vavr Set to a java.util.Set while preserving characteristics like insertion order (LinkedHashSet) and sort order (SortedSet).

public SortedSet<T>
union(Set<? extends T>
The set to form the union with.
elements
)

Redeclares io.vavr.collection.Set.union.

Adds all of the elements of that set to this set, if not already present.

public <T1, T2> Tuple2<? extends SortedSet<T1>, ? extends SortedSet<T2>>
unzip(Function<? super T, Tuple2<? extends T1, ? extends T2>>
a function which converts elements of this to pairs
unzipper
)

Redeclares io.vavr.collection.Set.unzip.

Unzips this elements by mapping this elements to pairs which are subsequently split into two distinct sets.

public <T1, T2, T3> Tuple3<? extends SortedSet<T1>, ? extends SortedSet<T2>, ? extends SortedSet<T3>>
unzip3(Function<? super T, Tuple3<? extends T1, ? extends T2, ? extends T3>>
a function which converts elements of this to pairs
unzipper
)

Redeclares io.vavr.collection.Set.unzip3.

Unzips this elements by mapping this elements to triples which are subsequently split into three distinct sets.

public <U> SortedSet<Tuple2<T, U>>
zip(Iterable<? extends U>
The Iterable providing the second half of each result pair.
that
)

Redeclares io.vavr.collection.Set.zip.

Returns a traversable formed from this traversable and another Iterable collection by combining corresponding elements in pairs.

public <U> SortedSet<Tuple2<T, U>>
zipAll(Iterable<? extends U>
The Iterable providing the second half of each result pair.
that
,
T
The element to be used to fill up the result if this traversable is shorter than that.
thisElem
,
U
The element to be used to fill up the result if that is shorter than this traversable.
thatElem
)

Redeclares io.vavr.collection.Set.zipAll.

Returns a traversable formed from this traversable and another Iterable by combining corresponding elements in pairs.

public <U, R> SortedSet<R>
zipWith(Iterable<? extends U>
The Iterable providing the second parameter of the mapper.
that
,
BiFunction<? super T, ? super U, ? extends R>
a mapper.
mapper
)

Redeclares io.vavr.collection.Set.zipWith.

Returns a traversable formed from this traversable and another Iterable collection by mapping elements.

public SortedSet<Tuple2<T, Integer>>
zipWithIndex()

Redeclares io.vavr.collection.Set.zipWithIndex.

Zips this traversable with its indices.

public <U> SortedSet<U>
zipWithIndex(BiFunction<? super T, ? super Integer, ? extends U>
a mapper.
mapper
)

Redeclares io.vavr.collection.Set.zipWithIndex.

Zips this traversable with its indices by applying mapper provided.

Inherited from io.vavr.collection.Ordered:
comparator
Inherited from io.vavr.collection.Set:
applycontainsisDistinctiteratorlengthnarrow