Java Topics

Overview

 ✓The collection in java is a framework that provides an architecture to store and manipulate the group of objects.

✓ collection framework is a group of classes and interfaces which are used to manage different types of collections.

✓ collections as a big set of inbuilt methods to perform basic operations such as add,remove, search,sorting etc.

✓java.util contains all the classes and interfaces for the collection framework.

✓ Every collection as at least one underlying data structure.

✓ collections are global in nature. The size of a collection can be changed dynamically at runtime.


Below are the few inbuilt methods present in collection interface.

1. public boolean add(E e) -> to insert an element.

2. public boolean remove(Object e)-> to delete an element.

3. public boolean removeAll(Collection<?> c)->to delete all the elements of specified collection.

4. public int size() -> It returns the total number of elements in the collection.


Below are the inbuilt methods present in Iterator interface.

1. public boolean hasNext()

2. public Object next()-> It returns the elements and move the cursor to next element.