Class TreeSet<E>
java.lang.Object
com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable<E>
com.github.andrewoma.dexx.collection.internal.base.AbstractIterable<E>
com.github.andrewoma.dexx.collection.internal.base.AbstractSet<E>
com.github.andrewoma.dexx.collection.internal.base.AbstractSortedSet<E>
com.github.andrewoma.dexx.collection.TreeSet<E>
- All Implemented Interfaces:
Iterable<E>, Set<E>, SortedSet<E>, Traversable<E>, Iterable<E>
TreeSet is an implementation of SortedSet backed by a TreeMap.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a set that adds the specified value if it doesn't already exist in this set.Comparator<? super E> Returns the comparator associated with this map, ornullif the default ordering is used.booleanReturns true if the value exists in this set.drop(int number) Returns a set containing all elements in this set, excluding the firstnumberof elements.static <E> @NotNull TreeSet<E> empty()static <E> @NotNull BuilderFactory<E, TreeSet<E>> factory(Comparator<? super E> ordering) first()Returns the first element in the set ornullof the set is empty.Returns the bottom of the set starting from the key specified.iterator()last()Returns the last element in the set ornullof the set is empty.Returns a subset of the set between thefromandtokeys specified.Removes the specified value from the set if it exists.intsize()Returns the size of the collection.take(int number) Returns a set containing the firstnumberof elements from this set.Returns the top of the set up until the key specified.Methods inherited from class AbstractSortedSet
asSortedSetMethods inherited from class AbstractSet
asSet, equals, hashCodeMethods inherited from class AbstractIterable
forEachMethods inherited from class AbstractTraversable
isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet, toStringMethods inherited from interface Iterable
forEach, spliteratorMethods inherited from interface Traversable
forEach, isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet
-
Field Details
-
tree
-
redBlackTree
-
EMPTY
-
-
Constructor Details
-
TreeSet
public TreeSet() -
TreeSet
-
TreeSet
-
-
Method Details
-
factory
@NotNull public static <E> @NotNull BuilderFactory<E, TreeSet<E>> factory(Comparator<? super E> ordering) -
empty
-
comparator
Description copied from interface:SortedSetReturns the comparator associated with this map, ornullif the default ordering is used. -
add
-
remove
-
contains
-
size
public int size()Description copied from interface:TraversableReturns the size of the collection.Warning: infinite collections are possible, as are collections that require traversal to calculate the size.
- Specified by:
sizein interfaceTraversable<E>- Overrides:
sizein classAbstractTraversable<E>
-
first
-
last
-
iterator
-
drop
-
take
-
from
Description copied from interface:SortedSetReturns the bottom of the set starting from the key specified. -
to
Description copied from interface:SortedSetReturns the top of the set up until the key specified. -
range
@NotNull public @NotNull SortedSet<E> range(@NotNull E from, boolean fromInclusive, @NotNull E to, boolean toInclusive) Description copied from interface:SortedSetReturns 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
-