Interface SortedSet<E>
-
- All Superinterfaces:
Iterable<E>,java.lang.Iterable<E>,Set<E>,Traversable<E>
- All Known Implementing Classes:
AbstractSortedSet,TreeSet
public interface SortedSet<E> extends Set<E>
SortedSetdefines the interface for sets that are sorted.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @NotNull SortedSet<E>add(E value)Returns a set that adds the specified value if it doesn't already exist in this set.java.util.SortedSet<E>asSortedSet()Returns an immutable view of this set as an instance ofjava.util.SortedSet.java.util.Comparator<? super E>comparator()Returns the comparator associated with this map, ornullif the default ordering is used.@NotNull SortedSet<E>drop(int number)Returns a set containing all elements in this set, excluding the firstnumberof elements.Efirst()Returns the first element in the set ornullof the set is empty.@NotNull SortedSet<E>from(E value, boolean inclusive)Returns the bottom of the set starting from the key specified.Elast()Returns the last element in the set ornullof the set is empty.@NotNull SortedSet<E>range(E from, boolean fromInclusive, E to, boolean toInclusive)Returns a subset of the set between thefromandtokeys specified.@NotNull SortedSet<E>remove(E value)Removes the specified value from the set if it exists.@NotNull SortedSet<E>take(int number)Returns a set containing the firstnumberof elements from this set.@NotNull SortedSet<E>to(E value, boolean inclusive)Returns the top of the set up until the key specified.-
Methods inherited from interface com.github.andrewoma.dexx.collection.Traversable
forEach, isEmpty, makeString, makeString, size, to, toArray, toArray, toIndexedList, toSet, toSortedSet
-
-
-
-
Method Detail
-
first
@Nullable E first()
Returns the first element in the set ornullof the set is empty.
-
last
@Nullable E last()
Returns the last element in the set ornullof the set is empty.
-
drop
@NotNull @NotNull SortedSet<E> drop(int number)
Returns a set containing all elements in this set, excluding the firstnumberof elements.
-
take
@NotNull @NotNull SortedSet<E> take(int number)
Returns a set containing the firstnumberof elements from this set.
-
add
@NotNull @NotNull SortedSet<E> add(E value)
Description copied from interface:SetReturns a set that adds the specified value if it doesn't already exist in this set.
-
remove
@NotNull @NotNull SortedSet<E> remove(E value)
Description copied from interface:SetRemoves the specified value from the set if it exists.
-
comparator
java.util.Comparator<? super E> comparator()
Returns the comparator associated with this map, ornullif the default ordering is used.
-
from
@NotNull @NotNull SortedSet<E> from(@NotNull E value, boolean inclusive)
Returns the bottom of the set starting from the key specified.- Parameters:
inclusive- if true, the key will be included in the result, otherwise it will be excluded
-
to
@NotNull @NotNull SortedSet<E> to(@NotNull E value, boolean inclusive)
Returns the top of the set up until the key specified.- Parameters:
inclusive- if true, the key will be included in the result, otherwise it will be excluded
-
range
@NotNull @NotNull SortedSet<E> range(@NotNull E from, boolean fromInclusive, @NotNull E to, boolean toInclusive)
Returns a subset of the set between thefromandtokeys specified.- Parameters:
fromInclusive- if true, the key will be included in the result, otherwise it will be excludedtoInclusive- if true, the key will be included in the result, otherwise it will be excluded
-
asSortedSet
@NotNull java.util.SortedSet<E> asSortedSet()
Returns an immutable view of this set as an instance ofjava.util.SortedSet.
-
-