What is the design pattern suitable to access elements of a Collection?

We can use Iterator design pattern to access the individual elements of a Collection. In case of an ordered collection we can get Iterator that returns the elements in an order.

In Java there are many implementation of Iterator in Collections package. We have iterators like- Spliterator, ListIterator etc. that implement Iterator pattern.

Leave a Reply

Your email address will not be published. Required fields are marked *