0% found this document useful (0 votes)
64 views

Sorted, Navigable, Tree Set Methods

The document describes interfaces and methods for working with sorted and navigable sets in Java. The SortedSet interface extends Set and adds methods for retrieving subsets, the first and last elements, and getting the comparator. NavigableSet extends SortedSet and adds navigation methods like lower, floor, ceiling and higher. The TreeSet class implements NavigableSet and can be used to create a red-black tree set that maintains sort order and supports fast access and retrieval of elements.

Uploaded by

Prabhakar Prabhu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views

Sorted, Navigable, Tree Set Methods

The document describes interfaces and methods for working with sorted and navigable sets in Java. The SortedSet interface extends Set and adds methods for retrieving subsets, the first and last elements, and getting the comparator. NavigableSet extends SortedSet and adds navigation methods like lower, floor, ceiling and higher. The TreeSet class implements NavigableSet and can be used to create a red-black tree set that maintains sort order and supports fast access and retrieval of elements.

Uploaded by

Prabhakar Prabhu
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

SORTEDSET Methods

public interface java.util.SortedSet<E> extends


java.util.Set<E> {

public abstract java.util.Comparator<? super E>


comparator();

public abstract java.util.SortedSet<E> subSet(E, E);

public abstract java.util.SortedSet<E> headSet(E);

public abstract java.util.SortedSet<E> tailSet(E);

public abstract E first();

public abstract E last();

public java.util.Spliterator<E> spliterator();

NavigableSet Methods

public interface java.util.NavigableSet<E> extends


java.util.SortedSet<E> {

public abstract E lower(E);

public abstract E floor(E);

public abstract E ceiling(E);

public abstract E higher(E);

public abstract E pollFirst();

public abstract E pollLast();

public abstract java.util.Iterator<E> iterator();

public abstract java.util.NavigableSet<E> descendingSet();

public abstract java.util.Iterator<E> descendingIterator();

public abstract java.util.NavigableSet<E> subSet(E, boolean,


E, boolean);
public abstract java.util.NavigableSet<E> headSet(E,
boolean);

public abstract java.util.NavigableSet<E> tailSet(E, boolean);

public abstract java.util.SortedSet<E> subSet(E, E);

public abstract java.util.SortedSet<E> headSet(E);

public abstract java.util.SortedSet<E> tailSet(E);

TREESET

public class java.util.TreeSet<E> extends


java.util.AbstractSet<E> implements
java.util.NavigableSet<E>, java.lang.Cloneabl

java.util.TreeSet(java.util.NavigableMap<E,
java.lang.Object>);

public java.util.TreeSet();

public java.util.TreeSet(java.util.Comparator<? super


E>);

public java.util.TreeSet(java.util.Collection<? extends


E>);

public java.util.TreeSet(java.util.SortedSet<E>);

public java.util.Iterator<E> iterator();

public java.util.Iterator<E> descendingIterator();

public java.util.NavigableSet<E> descendingSet();

public int size();

public boolean isEmpty();

public boolean contains(java.lang.Object);

public boolean add(E);


public boolean remove(java.lang.Object);

public void clear();

public boolean addAll(java.util.Collection<? extends E>);

public java.util.NavigableSet<E> subSet(E, boolean, E,


boolean);

public java.util.NavigableSet<E> headSet(E, boolean);

public java.util.NavigableSet<E> tailSet(E, boolean);

public java.util.SortedSet<E> subSet(E, E);

public java.util.SortedSet<E> headSet(E);

public java.util.SortedSet<E> tailSet(E);

public java.util.Comparator<? super E> comparator();

public E first();

public E last();

public E lower(E);

public E floor(E);

public E ceiling(E);

public E higher(E);

public E pollFirst();

public E pollLast();

public java.lang.Object clone();

public java.util.Spliterator<E> spliterator();

static {};

You might also like