java.util.TreeSet
A NavigableSet implementation based on a TreeMap.The elements are ordered using their natural ordering, or by a Comparator provided at a set creation time, depending on which constructor is used.
Some methods of TreeSet class.
higher(K): This method returns the least element in this set strictly greater than the given element, or null if there is no such element.
isEmpty(): This method returns true if this set contains no elements.
iterator(): This method returns an iterator over the elements in this set in ascending order.
last(): This method returns the last (highest) element currently in this set.
lower(K): This method returns the greatest element in this set strictly less than the given element, or null if there is no such element.
pollFirst(): This method retrieves and removes the first (lowest) element, or returns null if this set is empty.
pollLast(): This method retrieves and removes the last (highest) element, or returns null if this set is empty.
remove(Object): This method removes the specified element from this set if it is present.
size(): This method returns the number of elements in this set (its cardinality).
spliterator(): This method creates a late-binding and fail-fast Spliterator over the elements in this set.
subSet(K, K): This method returns a view of the portion of this set whose elements range from fromElement, inclusive, to toElement, exclusive.
subSet(K, boolean, K, boolean): This method returns a view of the portion of this set whose elements range from fromElement to toElement.
tailSet(K): This method returns a view of the portion of this set whose elements are greater than or equal to fromElement.
tailSet(K, boolean): This method returns a view of the portion of this set whose elements are greater than (or equal to, if inclusive is true) fromElement.
Some more methods of TreeSet class
No comments:
Post a Comment