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 com.github.andrewoma.dexx.collection.internal.base.AbstractSortedSet
asSortedSetMethods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractSet
asSet, equals, hashCodeMethods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractIterable
forEachMethods inherited from class com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable
isEmpty, makeString, makeString, to, toArray, toArray, toIndexedList, toSet, toSortedSet, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.github.andrewoma.dexx.collection.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
Description copied from interface:SetReturns a set that adds the specified value if it doesn't already exist in this set. -
remove
Description copied from interface:SetRemoves the specified value from the set if it exists. -
contains
Description copied from interface:SetReturns true if the value exists in this set. -
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
Description copied from interface:SortedSetReturns the first element in the set ornullof the set is empty. -
last
Description copied from interface:SortedSetReturns the last element in the set ornullof the set is empty. -
iterator
-
drop
Description copied from interface:SortedSetReturns a set containing all elements in this set, excluding the firstnumberof elements. -
take
Description copied from interface:SortedSetReturns a set containing the firstnumberof elements from this set. -
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
-