What is Collection?
In simple words, a collection refers to a group of objects or an amount of material accumulated in one location, especially for some purpose or as a result of some process.
When you talk about programming, it is basically performing some operation on data. Since computers are faster than humans, (but they aren’t smarter) they can process large amount of data easily.
Now to the original point what is collection in java?
When we connect the above two-point the collection is storing data in a single place, or you can refer to it as the data structure.
What is Framework?
In programming, Framework provides a ready-made architecture with predefined classes and interfaces.
Now we have enough information to define Collection Frameworks, It’s a prewritten code that makes it easy to implements data structures.
Java Collection framework provides many interfaces (Set, List, Queue, Deque) and classes (ArrayList, Vector, LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet).
The Collection framework represents a unified architecture for storing and manipulating a group of objects.
Collection Framework provides us with:-
- Collection interfaces — These interfaces represent different types of collections, such as Set, List, and Map. These interfaces form the basis of the framework.
- General-purpose implementations — These are primary implementations of the collection interfaces such as ArrayList, LinkedList, HashSet, LinkedHashSet, HashMap, etc.
- Legacy implementations — The collection classes from earlier releases, Vector and Hashtable, were retrofitted to implement the collection interfaces.
- Special-purpose implementations — Implementations designed for use in special situations such as CopyOnWriteArrayList, CopyOnWriteArraySet, EnumSet, EnumMap, WeakHashMap and IdentityHashMap etc.
- Concurrent implementations — These implementations designed for highly concurrent use such as ConcurrentSkipListSet, ConcurrentHashMap, ConcurrentSkipListMap etc.
- Wrapper implementations — Add functionality, such as synchronization, to other implementations.
- Convenience implementations — High-performance “mini-implementations” of the collection interfaces.
- Abstract implementations — Partial implementations of the collection interfaces to facilitate custom implementations such as AbstractCollection, AbstractSet, AbstractList, AbstractSequentialList and AbstractMap.
- Algorithms — Static methods that perform useful functions on collections, such as sorting a list.
- Infrastructure — Interfaces that provide essential support for the collection interfaces.
- Array Utilities — Utility functions for arrays of primitive types and reference objects. Not, strictly speaking, a part of the collections framework, this feature was added to the Java platform at the same time as the collections framework and relies on some of the same infrastructures.
Hierarchy of Collection Framework:-
General Purpose Implementation:-
To read more here is some link:-
Collections in Java - javatpoint
The Collection in Java is a framework that provides an architecture to store and manipulate the group of objects. Java…