Collection FrameWork!!
What is Collection in Java?
A Collection represents a single unit of objects, i.e., a group.
What is a framework in Java?
- It provides readymade architecture.
- It represents a set of classes and interfaces.
- It is optional.
What is Collection framework?
The Collection framework represents a unified architecture for storing and manipulating a group of objects. It has:
- Interfaces and its implementations, i.e., classes

So,Now i Start to Discuss about the ArrayList…

What Actually the ArrayList is?
The ArrayList class implements the List interface. It uses a dynamic array to store the duplicate element of different data types. The ArrayList class maintains the insertion order and is non-synchronized. The elements stored in the ArrayList class can be randomly accessed.
Why ArrayList is better than Array?
The limitation with array is that it has a fixed length so if it is full you cannot add any more elements to it, likewise if there are number of elements gets removed from it the memory consumption would be the same as it doesn’t shrink.
On the other hand ArrayList can dynamically grow and shrink after addition and removal of elements .Apart from these benefits ArrayList class enables us to use predefined methods of it which makes our task easy.
How to create an ArrayList?
We can create an ArrayList by writing a simple statement like this:
This statement creates an ArrayList with the name arr with type “String”. The type determines which type of elements the list will have. Since this list is of “String” type, the elements that are going to be added to this list will be of type “String”.
ArrayList<String> arr=new ArrayList<String>();Similarly we can create ArrayList that accepts int elements.
ArrayList<Integer> arr=new ArrayList<Integer>();How to add elements to an ArrayList?
We add elements to an ArrayList by using add() method, this method has couple of variations, which we can use based on the requirement. For example: If we want to add the element at the end of the List then simply do it like this:
arr.add("Smith"); //This will add "Smith" at the end of ListTo add the element at the specified location in ArrayList, we can specify the index in the add method like this:
arr.add(3, "Smith"); //This will add "Steve" at the fourth positionlets Write the Code as an Example 1:

Output is Something Like that:

Example 2:

Output:

There are some Methods in ArrayList u can open these methods through this Link.
https://www.geeksforgeeks.org/arraylist-in-java/
Thats All ……….ThankYou!!!!