Java Collections
In Java, a Collection (a single unit of objects) is a framework that provides an architecture for storing and manipulating a collection of objects. [1]
All data actions, including searching, sorting, insertion, manipulation, and deletion, can be accomplished with Java Collections. [1]
Many interfaces are available in the Java Collection framework. [1]
The collections in Java are represented by the UML diagram below:
Iterable interface
Because the Collection interface extends the Iterable interface, all of the Collection interface’s subclasses also implement the Iterable interface. The iterator() function is the single method in the iterable interface. [1]
Iterator<T> iterator()
Iterator interface
Used for traversing elements in a collection. [1]
The Iterator interface allows you to iterate elements in a forward direction only. [1]
public boolean hasNext(): Returns true if the iterator has more elements.
public Object next(): Returns the element and moves the cursor pointer to the next element.[1]