The Java Collection Framework: A Unified Architecture For Representing and Manipulating Collections
The Java Collection Framework: A Unified Architecture For Representing and Manipulating Collections
Interfaces Implementations Algorithms It reduces programming effort It increases program speed and quality It allows interoperability among unrelated APIs It fosters software reuse
Advantages
Interfaces
z z
Collection
general interface cannot contain duplicate elements ordered collection maintains its elements in ascending order
Set
z z
List
SortedSet
Object Ordering
z
provides a natural ordering allows objects of that class to be sorted automatically could be sorted in the natural orderering by method Collections.sort(List l) all objects sorted according to the natural ordering
List
SortedSet
Implementation
z z
SortedSet
List
Comparable interface
z
Source code
public interface Comparable { public int compareTo(Object ob); }
Collection interface