Submitted by heartin on Sun, 09/27/2015 - 17:30
Collection framework in Java provides a set of readily usable efficient implementations for commonly used data structures and algorithms. A basic understanding of the data constructs like arrays, String, linked list, stack, queue and trees, and concepts like hashing, will help you understand collections better. Collections are often used along with the Generics feature to provide reusable and type safe implementations for these data structures and algorithms. [node:read-more:link]
Submitted by heartin on Sat, 10/10/2015 - 22:46
TreeSet Class implements NavigableSet and is based on a TreeMap.
Important properties of a TreeMap class
-
The elements are ordered using their natural ordering, or by a Comparator
-
Provides guaranteed log(n) time cost for the basic operations like add, remove and contains.
Submitted by heartin on Sat, 10/10/2015 - 19:52
Set is a collection that models the mathematical set abstraction and contains no duplicate elements.
Important properties of Set interface
-
Sets contain no pair of elements e1 and e2 such that e1.equals(e2), and at most one null element.
-
The Set interface places additional stipulations on:
Submitted by heartin on Sat, 10/10/2015 - 00:44
TreeMap is a Red-Black tree based NavigableMap implementation.
Important properties of TreeMap
-
The map is sorted according to the natural ordering of its keys, or by a Comparator provided at map creation time.
-
Provides guaranteed log(n) time cost for the containsKey, get, put and remove operations.
Submitted by heartin on Sat, 10/10/2015 - 00:06
SortedMap interface extends Map interface to further provide a total ordering on its keys.
Important Properties of SortedMap
-
SortedMap is ordered according to the natural ordering of its keys, or by a Comparator typically provided at sorted map creation time.
-
Order is reflected when iterating over the sorted map's collection views returned by the entrySet, keySet and values methods.
-
SortedMap is the map analogue of SortedSet.
Pages