Tech with Maddy

Tech with Maddy

Subscribe to my newsletter and never miss my upcoming articles

How does the "forEach" loop work in Java?

Oct 24, 20214 min read

Java 8 has introduced many features, and the forEach() method is one of them. In short, it's a way to iterate over a Collection (for example, a map, a set or a list) or a Stream. The forEach() takes only one parameter, which is a functional inter...

How does the "forEach" loop work in Java?
What is the meaning of "?" in Java?
What does <T> mean in Java?
How to handle NullPointerException using Optional class
What does :: mean in Java?
5 Things I Wish I Knew When Starting My Computer Science Degree