Collections Framework in Java
What is Java Collections Framework?
Collections Framework was introduced in Java 1.2 . The Java collections framework (JCF) is a set of classes and interfaces that implement commonly reusable collection data structures. Collection framework has many different interfaces and classes. Each and every interface and class has different purpose. We can perform add, edit, delete etc., operations on group of objects as per methods and implementation of a class.
What is a Collection?
A collection is an object that represents a group of individual objects represented as a single unit. Collection is a dynamic array where we can add elements and reduce elements.
Arrays vs Collections:
Both Collections and Arrays hold references to Objects and can be managed as a group.
Collections do not need to be assigned a certain capacity when instantiated where as Arrays need to be assigned certain capacity when instantiated.
Collections can grow and shrink in size automatically when objects are added or removed where as Arrays contain fixed size.
Collections cannot hold basic data type elements (primitive types such as int, long, or double; instead, they hold Wrapper Classes such as Integer, Long, or Double) where as Arrays hold basic data type elements.
Types of Collections:
There are also three generic types of collection: Ordered lists, Maps, and Sets.
Collections Framework contains following interfaces
1. Set
2. List
3. Queue
4. Deque
Some of the classes are as follows
1. ArrayList
2. Vector
3. LinkedList
4. HashSet
5. TreeSet
6. PriotyQueue
Hi Rajkumar,
Thnx for explaining applications of OOPS in a simple language. I regularly read the articles posted on this website. The site is just too good. the way you write and explain the topics is what i like it most.
Do keep posting more articles on automation testing and on tools.
Thnx in advance….
Thanks for following us Kaustubh Vartak. We will try to come up with regular updates.