# navigable set and sorted set

posted 5 years ago

please go through JAVA 6 API here ..

SortedSet<E> is the super interface of NavigableSet<E> and is a sub interface of Set<E>

or in other words, Iterable<E> -> Collection<E> -> Set <E> -> SortedSet<E> -> NavigableSet<E> -> TreeSet<E> is the inheritance tree.

TreeSet<E> implements NavigableSet<E>

SortedSet<E> ss = TreeSet<E> ts. headSet(E element) // This returns a SortedSet

where as

NavigableSet<E> ns = TreeSet<E> ts.headSet(E element, boolean b) // this returns a Navigable Set

this is same with tailSet() and subSet() which are in SCJP6 objectives!

hope this is clear

- 0

Prasad Kharkar wrote:what is the difference between navigable set and sorted set?

please go through JAVA 6 API here ..

SortedSet<E> is the super interface of NavigableSet<E> and is a sub interface of Set<E>

or in other words, Iterable<E> -> Collection<E> -> Set <E> -> SortedSet<E> -> NavigableSet<E> -> TreeSet<E> is the inheritance tree.

TreeSet<E> implements NavigableSet<E>

SortedSet<E> ss = TreeSet<E> ts. headSet(E element) // This returns a SortedSet

where as

NavigableSet<E> ns = TreeSet<E> ts.headSet(E element, boolean b) // this returns a Navigable Set

this is same with tailSet() and subSet() which are in SCJP6 objectives!

hope this is clear

SCJP6, SCWCD5, OCP-JBCD5, OCE-JWSD6 OCE-JPAD6 , OCM-JEA5 1,OCM-JEA5 2,3 - Brainbench certifications: J2EE, Java2, Java2-NonGUI, JSP, SQL2000 Admin, SQL2000 Programming , Brainbench certified Java Programmer, Computer Programmer, Web Developer, Database Administrator

I agree. Here's the link: http://aspose.com/file-tools |