SLIDE 1
1
1
Java Collection framework: On concrete collections and their implementation
2
Concrete collections in Java library
- ArrayList: indexed sequence that grows/shrinks dynamically
- LinkedList: ordered sequence that allows efficient insertions
and removal at any location
- HashSet: unordered collection that rejects duplicates
- TreeSet: sorted set
- EnumSet: set of enumerated type values (implements Set)
- LinkedHashSet: set that remembers the order in which elements
were inserted
- PriorityQueue: allows efficient removal of the smallest element
- HashMap: stores key/value associations
- TreeMap: map in which the keys are sorted
- EnumMap: keys belong to an enumerated type (impl. Map)
- LinkedHashMap: remembers the order in which added
- WeakHashMap: keys and entries that can be reclaimed by the
garbage collector if the keys are not used elsewhere
- IdentityHashMap: keys that are compared by ==, not equals
3
LinkedList: doubly-linked list
- LinkedList implements the List interface and extends
the AbstractCollection class (indirectly through AbstractSequentialList)
- offers inexpensive operations to add into and remove
from the middle of a data structure
- LinkedList also gives (expensive) implementations
for using array indices: get (i), listIterator (i), etc.
- LinkedList provides methods to get, remove and