|
|
|
JDK 6 Tutorials
|
Navigable Map Example
In NavigableMap we use methods to return the key value pair like navMap.put(1, "January"); whereas in NavigableSet we use methods to return values. ConcurrentSkipListMap is the one of the class which implements NavigableMap.
View Rating |
|
|
JDK 6 Tutorials
|
Navigable Set Example
In the example below we have used NavigableSet method to sort the elements in ascending order, descending order, also to retrieve the element which is immediately greater than or equal to 35 etc.
View Rating |
|
|
JDK 6 Tutorials
|
Tree Set Example
In the following example, we have used the TreeSet collection, which is similar to TreeMap that stores its elements in a tree and maintain order of its elements based on their values.
View Rating |
|
|