Data structures exercise: Making a collection available to Java’s For Each loops

Alonso Del Arte
Dev Genius
Published in
11 min readAug 5, 2021

--

Photo by Noah Negishi on Unsplash

One of the nice things about java.util.ArrayList is that you can iterate through the contents of a list with an “enhanced” For loop called the “For Each” loop. For example, given

ArrayList<Transaction> trx = account.getTransactions();

--

--

is a Java and Scala developer from Detroit, Michigan. AWS Cloud Practitioner Foundational certified