new classes and interface in Collection in jdk 6
- Java 6 introduced (among others) two new interfaces: java.util.NavigableSet and java.util.NavigableMap. Here TreeSet class implements NavigableSet interface and TreeMap implements NavigableMap interface.
- PrirorityQueue is the new class added which implements Queue interface which extends Collection interface.
Here are the methods provided by these Navigable.... interfaces.
TreeSet.ceiling(e) Returns the lowest element >= e
TreeMap.ceilingKey(key) Returns the lowest key >= key
TreeSet.higher(e) Returns the lowest element > e
TreeMap.higherKey(key) Returns the lowest key > key
TreeSet.floor(e) Returns the highest element <= e
TreeMap.floorKey(key) Returns the highest key <= key
TreeSet.lower(e) Returns the highest element < e
TreeMap.lowerKey(key) Returns the highest key < key
TreeSet.pollFirst() Returns and removes the first entry
TreeMap.pollFirstEntry() Returns and removes the first key-value pair
TreeSet.pollLast() Returns and removes the last entry
TreeMap.pollLastEntry() Returns and removes the last key-value pair
TreeSet.descendingSet() Returns a NavigableSet in reverse order
TreeMap.descendingMap() Returns a NavigableMap in reverse order
Comments
Post a Comment