A collection represents a group of objects, known as its elements. This framework is provided in the java.util package. Objects can be stored, retrieved, and manipulated as elements of collections. For more see what are collections?
In java 5, queue was also provided. From the figure we get that in the Collections Framework, the interfaces Map and Collection are distinct with no lineage in the hierarchy. The typical application of map is to provide access to values stored by keys. When designing software with the Collection Framework, it is useful to remember the following hierarchical relationship of the four basic interfaces of the framework.
The historical collection classes are called such because they have been around since 1.0 release of the java class libraries. If you are moving from historical collection to the new framework classes, one of the primary differences is that all operations are synchronized with the new classes. While you can add synchronization to the new classes, you cannot remove from the old. See here - list of interfaces and classes in collections
Collection Framework
A Collections Framework mainly contains the following 3 parts -- Interfaces
- Concrete class implementation of the iterfaces
- Algorithms to deal with these classes and interfaces
- Collection
- Iterator
- Set
- List
- SortedSet
- Map
- SortedMap
- Queue (Added in jdk 5)
- Deque (Added in jdk 5)
In java 5, queue was also provided. From the figure we get that in the Collections Framework, the interfaces Map and Collection are distinct with no lineage in the hierarchy. The typical application of map is to provide access to values stored by keys. When designing software with the Collection Framework, it is useful to remember the following hierarchical relationship of the four basic interfaces of the framework.
- The Collection interface is a group of objects, with duplicates allowed.
- Set extends Collection but forbids duplicates.
- List extends Collection also, allows duplicates and introduces positional indexing.
- Map extends neither Set nor Collection
- Iterator is not part of collection
Collection Framework part 2 : Interfaces and their implementations
These are concrete implementations of the collection interfaces. In essence, these are reusable data structures.Interface | Implementations | ||||
Array | Balanced Tree | Linked List | Hash table | Historical | |
List | ArrayList | LinkedList | Vector, Stack | ||
Map | TreeMap | HashMap | HashTable, Properties | ||
Set | TreeSet | HashSet | |||
Deque | ArrayDeque | LinkedList |
No comments:
Post a Comment