Java Collections

Cahit Barkin Ozer
4 min readNov 15, 2021

For Access: https://cbarkinozer.medium.com/collections-in-java-ec0a22fbc25e?source=friends_link&sk=b86427f1a6108b5f3634d16873aa1f6c

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:

Hierarchy of the Collection Framework[1]

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]

--

--

Cahit Barkin Ozer
Cahit Barkin Ozer

Written by Cahit Barkin Ozer

Üretken YZ başta olmak üzere teknoloji alanındaki yenilikleri öğrenip sizlerle paylaşıyorum. Youtube Kanalım: https://www.youtube.com/@cbarkinozer

No responses yet