Collection is a simply an object that represents a group of objects into a single unit.
Collection framework is a unified architecture or a set classes and interfaces for representing and manipulating collections. i.e. collection framework is used to store, retrieve and manipulate collections.
Collection framework contains following:
- Interfaces: are abstract data types that represent collections and allow collections to be manipulated independently of the details of their representation.
- Classes/Implementations: are the concrete implementations of the collection interfaces.
- Algorithms: are the methods used for collection computations, like searching and sorting.
Advantages/Benefits of collection framework:
- Reduces programming effort: Collection framework provides useful data structure and algorithms for collection manipulation, you not have to write them.
- Increases program speed and quality: Collection framework provides high-performance and high-quality implementations of useful data structures and algorithms which increase the speed and quality.
- Resizable: Collection is resizable.
- Reduces effort to design new APIs: becausecollection framework eliminates the need to produce ad hoc collections APIs.
Disadvantages of collection framework:
- It must cast to correct type.
- It can’t be done compile-time type checking.
Note: Above two disadvantages can be removed from collection framework by using generics.
Core Collection Framework interfaces are categories into two sets collections and maps.
Note: Maps are not the integral part of collection framework but are considered as collection because they can store and manipulate group of objects like collections.
- Collection framework.
- Collection interfaces.
- Set interface
- SortedSet interface
- List interface
- Map interface
- Map.Entry interface
- SortedMap interface
- Queue interface
- Deque interface
- Enumeration interface
- Collection classes
- Abstract classes in collection framework
- Comparable interface
- Comparator interface
- Properties class
- ListIterator interface
- Java Vector class
- ArrayList vs LinkedList vs Vector
- Iterator vs ListIterator vs Enumeration
- List vs Set Vs Map
- HashSet vs LinkedHashSet vs TreeSet
- HashMap vs LinkedHashMap vs TreeMap vs HashTable
- HashSet vs HashMap vs HashTable
- Collection vs collections
- Comparable vs Comparator interfaces
- Java hashcode and equals methods
- HashMep internal working
- HashMap null key
- HashSet internal working
- Collection framework interview programs