Collection Framework in Java
Hi Friends, In this tutorial we will discuss about Collection Framework In Java, different classes and Interfaces which are inside the collection framework, methods of List and will see sample code of List and ArrayList.
What is Collection in Java?
In single line we can say collection is a group of objects. In collection to represent the group of objects into single entity we need set of classes and interfaces.
Java Collection Framework provides many classes(ArrayList, LinkedList, Vector etc.) and Interfaces (List, Set, Queue, Deque).
Why Collection Framework in Java?
Without collection we can store the objects into single unit but there is some limitations without collection. For example if we will store data using array then we can store only homogeneous data type. If we create array with int type then we can store only integer data type.
Other limitation is array size is always fix. We cannot change the size at runtime.
To overcome above limitations we have Collection in Java.
What is Collections?
Collections is a class which is present in java.util package. Collections contain the methods which are used in Collection to perform certain operations.
Read Full Article — https://automationtestings.com/collection-framework-java/