Skip to content

Tag Archives: Java-Iterator

To replace an element from an ArrayList, the set() method of ListIterator interface can be used. set() method of ListIterator replaces the last element which… Read More
Collection in Java is a set of interfaces like List, Set, and Queue. An iterator in Java is used to iterate or traverse through the… Read More
ListIterator is one of the four java cursors. It is a java iterator that is used to traverse all types of lists including ArrayList, Vector,… Read More
Java Iterator Interface of java collections allows us to access elements of the collection and is used to iterate over the elements in the collection(Map,… Read More
Enumeration is an interface. It is used in the collection framework in java to retrieve the elements one by one. Enumeration is a legacy interface… Read More
Given a 2D list, the task is to iterate this 2D list in Java. 2D list (list of lists) The 2D list refers to a… Read More
Iterators are used in Collection framework in Java to retrieve elements one by one. It can be applied to any Collection object. By using Iterator,… Read More
Given an Iterator, the task is to convert it into List in Java. Examples: Input: Iterator = {1, 2, 3, 4, 5} Output: {1, 2,… Read More
Given an Iterator, the task is to convert it into Stream in Java. Examples: Input: Iterator = {1, 2, 3, 4, 5} Output: {1, 2,… Read More
Given an Iterator, the task is to convert it into Spliterators in Java. Examples: Input: Iterator = {1, 2, 3, 4, 5} Output: {1, 2,… Read More
Given an Iterator, the task is to convert it into Iterables in Java. Examples: Input: Iterator = {1, 2, 3, 4, 5} Output: {1, 2,… Read More
The iterator() method of PriorityBlockingQueue class Returns an iterator over the elements in this queue. The elements returned from this method do not follow any… Read More
HashMap stores the data in (Key, Value) pairs, and you can access them by an index of another type. HashMap class implements Map interface which… Read More
Iterators, in Java, are used in Collection Framework to retrieve elements one by one. A stream in Java is a pipeline of objects from an… Read More
In this article, I am going to explain how those collections behave which doesn’t iterate as fail-fast. First of all, there is no term as… Read More