T
- Component typepublic interface SortedSet<T> extends Set<T>
SortedSet
interface.Modifier and Type | Method and Description |
---|---|
SortedSet<T> |
add(T element)
Add the given element to this set, if it is not already contained.
|
SortedSet<T> |
addAll(Iterable<? extends T> elements)
Adds all of the given elements to this set, if not already contained.
|
SortedSet<T> |
clear()
Returns an empty version of this traversable, i.e.
|
Comparator<? super T> |
comparator()
Returns the underlying comparator which defines the order of the elements contained in this set.
|
SortedSet<T> |
diff(Set<? extends T> elements)
Calculates the difference between this set and another set.
|
SortedSet<T> |
distinct()
Returns a new version of this which contains no duplicates.
|
SortedSet<T> |
distinctBy(Comparator<? super T> comparator)
Returns a new version of this which contains no duplicates.
|
<U> SortedSet<T> |
distinctBy(java.util.function.Function<? super T,? extends U> keyExtractor)
Returns a new version of this which contains no duplicates.
|
SortedSet<T> |
drop(int n)
Drops the first n elements of this or all elements, if this length < n.
|
SortedSet<T> |
dropRight(int n)
Drops the last n elements of this or all elements, if this length < n.
|
SortedSet<T> |
dropWhile(java.util.function.Predicate<? super T> predicate)
Drops elements while the predicate holds for the current element.
|
SortedSet<T> |
filter(java.util.function.Predicate<? super T> predicate)
Returns a new traversable consisting of all elements which satisfy the given predicate.
|
<U> SortedSet<U> |
flatMap(Comparator<? super U> comparator,
java.util.function.Function<? super T,? extends Iterable<? extends U>> mapper)
Same as
flatMap(Function) but using a specific comparator for values of the codomain of the given
mapper . |
<U> SortedSet<U> |
flatMap(java.util.function.Function<? super T,? extends Iterable<? extends U>> mapper)
FlatMaps this value to a new value with different component type.
|
SortedSet<Object> |
flatten()
Flattens this
Value . |
<C> Map<C,? extends SortedSet<T>> |
groupBy(java.util.function.Function<? super T,? extends C> classifier)
Groups this elements by classifying the elements.
|
SortedSet<T> |
init()
Dual of TraversableOnce.tail(), returning all elements except the last.
|
Option<? extends SortedSet<T>> |
initOption()
Dual of TraversableOnce.tailOption(), returning all elements except the last as
Option . |
SortedSet<T> |
intersect(Set<? extends T> elements)
Computes the intersection between this set and another set.
|
default T |
last()
Dual of TraversableOnce.head(), returning the last element.
|
<U> SortedSet<U> |
map(Comparator<? super U> comparator,
java.util.function.Function<? super T,? extends U> mapper)
Same as
map(Function) but using a specific comparator for values of the codomain of the given
mapper . |
<U> SortedSet<U> |
map(java.util.function.Function<? super T,? extends U> mapper)
Maps the elements of this traversable to elements of a new type preserving their order, if any.
|
Tuple2<? extends SortedSet<T>,? extends SortedSet<T>> |
partition(java.util.function.Predicate<? super T> predicate)
Creates a partition of this
TraversableOnce by splitting this elements in two in distinct tarversables
according to a predicate. |
SortedSet<T> |
peek(java.util.function.Consumer<? super T> action)
Performs the given
action on the first element if this is an eager implementation. |
SortedSet<T> |
remove(T element)
Removes a specific element from this set, if present.
|
SortedSet<T> |
removeAll(Iterable<? extends T> elements)
Removes all of the given elements from this set, if present.
|
SortedSet<T> |
replace(T currentElement,
T newElement)
Replaces the first occurrence (if exists) of the given currentElement with newElement.
|
SortedSet<T> |
replaceAll(T currentElement,
T newElement)
Replaces all occurrences of the given currentElement with newElement.
|
SortedSet<T> |
retainAll(Iterable<? extends T> elements)
Keeps all occurrences of the given elements from this.
|
Tuple2<? extends SortedSet<T>,? extends SortedSet<T>> |
span(java.util.function.Predicate<? super T> predicate)
Returns a tuple where the first element is the longest prefix of elements that satisfy p and the second element is the remainder.
|
SortedSet<T> |
tail()
Drops the first element of a non-empty TraversableOnce.
|
Option<? extends SortedSet<T>> |
tailOption()
Drops the first element of a non-empty TraversableOnce and returns an
Option . |
SortedSet<T> |
take(int n)
Takes the first n elements of this or all elements, if this length < n.
|
SortedSet<T> |
takeRight(int n)
Takes the last n elements of this or all elements, if this length < n.
|
SortedSet<T> |
takeUntil(java.util.function.Predicate<? super T> predicate)
Takes elements until the predicate holds for the current element.
|
SortedSet<T> |
takeWhile(java.util.function.Predicate<? super T> predicate)
Takes elements while the predicate holds for the current element.
|
SortedSet<T> |
union(Set<? extends T> elements)
Adds all of the elements of
that set to this set, if not already present. |
<T1,T2> Tuple2<? extends SortedSet<T1>,? extends SortedSet<T2>> |
unzip(java.util.function.Function<? super T,Tuple2<? extends T1,? extends T2>> unzipper)
Unzips this elements by mapping this elements to pairs which are subsequentially split into two distinct
sets.
|
<U> SortedSet<Tuple2<T,U>> |
zip(Iterable<U> that)
Returns a traversable formed from this traversable and another java.lang.Iterable collection by combining
corresponding elements in pairs.
|
<U> SortedSet<Tuple2<T,U>> |
zipAll(Iterable<U> that,
T thisElem,
U thatElem)
Returns a traversable formed from this traversable and another java.lang.Iterable by combining corresponding elements in
pairs.
|
SortedSet<Tuple2<T,Integer>> |
zipWithIndex()
Zips this traversable with its indices.
|
contains, iterator, length, spliterator
hash
average, containsAll, existsUnique, findFirst, findLast, fold, foldLeft, foldRight, get, hasDefiniteSize, head, headOption, isEmpty, isTraversableAgain, lastOption, max, maxBy, maxBy, min, minBy, minBy, mkString, mkString, mkString, product, reduce, reduceLeft, reduceRight, sum
equals, get, getOption, hashCode, ifDefined, ifDefined, ifEmpty, ifEmpty, isDefined, orElse, orElseGet, orElseThrow, out, out, stderr, stdout, toArray, toCharSeq, toJavaArray, toJavaList, toJavaMap, toJavaOptional, toJavaSet, toJavaStream, toLazy, toList, toMap, toOption, toQueue, toSet, toStack, toStream, toString, toTree, toTry, toVector
Comparator<? super T> comparator()
<U> SortedSet<U> flatMap(Comparator<? super U> comparator, java.util.function.Function<? super T,? extends Iterable<? extends U>> mapper)
flatMap(Function)
but using a specific comparator for values of the codomain of the given
mapper
.U
- Type of flat-mapped valuescomparator
- A comparator for values of type Umapper
- A function which maps values of type T to Iterables of values of type U<U> SortedSet<U> map(Comparator<? super U> comparator, java.util.function.Function<? super T,? extends U> mapper)
map(Function)
but using a specific comparator for values of the codomain of the given
mapper
.U
- Type of mapped valuescomparator
- A comparator for values of type Umapper
- A function which maps values of type T to values of type USortedSet<T> add(T element)
Set
SortedSet<T> addAll(Iterable<? extends T> elements)
Set
SortedSet<T> clear()
TraversableOnce
this.clear().isEmpty() == true
.clear
in interface Set<T>
clear
in interface Traversable<T>
clear
in interface TraversableOnce<T>
SortedSet<T> diff(Set<? extends T> elements)
Set
See also Set.removeAll(Iterable)
.
SortedSet<T> distinct()
TraversableOnce
equals
.distinct
in interface Set<T>
distinct
in interface Traversable<T>
distinct
in interface TraversableOnce<T>
TraversableOnce
containing this elements without duplicatesSortedSet<T> distinctBy(Comparator<? super T> comparator)
TraversableOnce
comparator
.distinctBy
in interface Set<T>
distinctBy
in interface Traversable<T>
distinctBy
in interface TraversableOnce<T>
comparator
- A comparatorTraversableOnce
containing this elements without duplicates<U> SortedSet<T> distinctBy(java.util.function.Function<? super T,? extends U> keyExtractor)
TraversableOnce
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 Traversable<T>
distinctBy
in interface TraversableOnce<T>
U
- key typekeyExtractor
- A key extractorTraversableOnce
containing this elements without duplicatesSortedSet<T> drop(int n)
TraversableOnce
drop
in interface Set<T>
drop
in interface Traversable<T>
drop
in interface TraversableOnce<T>
n
- The number of elements to drop.SortedSet<T> dropRight(int n)
TraversableOnce
dropRight
in interface Set<T>
dropRight
in interface Traversable<T>
dropRight
in interface TraversableOnce<T>
n
- The number of elements to drop.SortedSet<T> dropWhile(java.util.function.Predicate<? super T> predicate)
TraversableOnce
dropWhile
in interface Set<T>
dropWhile
in interface Traversable<T>
dropWhile
in interface TraversableOnce<T>
predicate
- A condition tested subsequently for this elements starting with the first.SortedSet<T> filter(java.util.function.Predicate<? super T> predicate)
TraversableOnce
<U> SortedSet<U> flatMap(java.util.function.Function<? super T,? extends Iterable<? extends U>> mapper)
Value
SortedSet<Object> flatten()
Value
Value
.
The semantics may vary from class to class. The commonality is, that some kind of wrapped state is recursively unwrapped.
Example:
(((1))).flatten() = (1)
<C> Map<C,? extends SortedSet<T>> groupBy(java.util.function.Function<? super T,? extends C> classifier)
TraversableOnce
groupBy
in interface Set<T>
groupBy
in interface Traversable<T>
groupBy
in interface TraversableOnce<T>
C
- classified class typeclassifier
- A function which classifies elements into classesSortedSet<T> init()
TraversableOnce
init
in interface Set<T>
init
in interface Traversable<T>
init
in interface TraversableOnce<T>
Option<? extends SortedSet<T>> initOption()
TraversableOnce
Option
.initOption
in interface Set<T>
initOption
in interface Traversable<T>
initOption
in interface TraversableOnce<T>
Some(traversable)
or None
if this is empty.SortedSet<T> intersect(Set<? extends T> elements)
Set
See also Set.retainAll(Iterable)
.
default T last()
TraversableOnce
last
in interface TraversableOnce<T>
<U> SortedSet<U> map(java.util.function.Function<? super T,? extends U> mapper)
TraversableOnce
map
in interface Set<T>
map
in interface Traversable<T>
map
in interface TraversableOnce<T>
map
in interface Value<T>
U
- Component type of the target TraversableOncemapper
- A mapper.Tuple2<? extends SortedSet<T>,? extends SortedSet<T>> partition(java.util.function.Predicate<? super T> predicate)
TraversableOnce
TraversableOnce
by splitting this elements in two in distinct tarversables
according to a predicate.partition
in interface Set<T>
partition
in interface Traversable<T>
partition
in interface TraversableOnce<T>
predicate
- A predicate which classifies an element if it is in the first or the second traversable.TraversableOnce
contains all elements that satisfy the given predicate
, the second TraversableOnce
contains all elements that don't. The original order of elements is preserved.SortedSet<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.SortedSet<T> remove(T element)
Set
SortedSet<T> removeAll(Iterable<? extends T> elements)
Set
SortedSet<T> replace(T currentElement, T newElement)
TraversableOnce
replace
in interface Set<T>
replace
in interface Traversable<T>
replace
in interface TraversableOnce<T>
currentElement
- An element to be substituted.newElement
- A replacement for currentElement.SortedSet<T> replaceAll(T currentElement, T newElement)
TraversableOnce
replaceAll
in interface Set<T>
replaceAll
in interface Traversable<T>
replaceAll
in interface TraversableOnce<T>
currentElement
- An element to be substituted.newElement
- A replacement for currentElement.SortedSet<T> retainAll(Iterable<? extends T> elements)
TraversableOnce
retainAll
in interface Set<T>
retainAll
in interface Traversable<T>
retainAll
in interface TraversableOnce<T>
elements
- Elements to be kept.Tuple2<? extends SortedSet<T>,? extends SortedSet<T>> span(java.util.function.Predicate<? super T> predicate)
TraversableOnce
span
in interface Set<T>
span
in interface Traversable<T>
span
in interface TraversableOnce<T>
predicate
- A predicate.SortedSet<T> tail()
TraversableOnce
tail
in interface Set<T>
tail
in interface Traversable<T>
tail
in interface TraversableOnce<T>
Option<? extends SortedSet<T>> tailOption()
TraversableOnce
Option
.tailOption
in interface Set<T>
tailOption
in interface Traversable<T>
tailOption
in interface TraversableOnce<T>
Some(traversable)
or None
if this is empty.SortedSet<T> take(int n)
TraversableOnce
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.
take
in interface Set<T>
take
in interface Traversable<T>
take
in interface TraversableOnce<T>
n
- The number of elements to take.SortedSet<T> takeRight(int n)
TraversableOnce
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 Traversable<T>
takeRight
in interface TraversableOnce<T>
n
- The number of elements to take.SortedSet<T> takeUntil(java.util.function.Predicate<? super T> predicate)
TraversableOnce
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 Traversable<T>
takeUntil
in interface TraversableOnce<T>
predicate
- A condition tested subsequently for this elements.SortedSet<T> takeWhile(java.util.function.Predicate<? super T> predicate)
TraversableOnce
takeWhile
in interface Set<T>
takeWhile
in interface Traversable<T>
takeWhile
in interface TraversableOnce<T>
predicate
- A condition tested subsequently for the contained elements.SortedSet<T> union(Set<? extends T> elements)
Set
that
set to this set, if not already present.
See also Set.addAll(Iterable)
.
<T1,T2> Tuple2<? extends SortedSet<T1>,? extends SortedSet<T2>> unzip(java.util.function.Function<? super T,Tuple2<? extends T1,? extends T2>> unzipper)
TraversableOnce
unzip
in interface Set<T>
unzip
in interface Traversable<T>
unzip
in interface TraversableOnce<T>
T1
- 1st element type of a pair returned by unzipperT2
- 2nd element type of a pair returned by unzipperunzipper
- a function which converts elements of this to pairs<U> SortedSet<Tuple2<T,U>> zip(Iterable<U> that)
TraversableOnce
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 Traversable<T>
zip
in interface TraversableOnce<T>
U
- The type of the second half of the returned pairs.that
- The java.lang.Iterable providing the second half of each result pair.that
iterable.<U> SortedSet<Tuple2<T,U>> zipAll(Iterable<U> that, T thisElem, U thatElem)
TraversableOnce
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 Traversable<T>
zipAll
in interface TraversableOnce<T>
U
- The type of the second half of the returned pairs.that
- The java.lang.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.SortedSet<Tuple2<T,Integer>> zipWithIndex()
TraversableOnce
zipWithIndex
in interface Set<T>
zipWithIndex
in interface Traversable<T>
zipWithIndex
in interface TraversableOnce<T>
Copyright © 2015. All Rights Reserved.