Java Program to Iterate over ArrayList using Lambda Expression

To understand this example, you should have the knowledge of the following Java programming topics:


Example: Pass ArrayList as Function Parameter

Output

ArrayList: Java, Python, JavaScript,

In the above example, we have created an arraylist named languages. Notice the code,

languages.forEach((e) -> {
  System.out.print(e + ", ");
});

Here, we are passing the lambda expression as an argument to ArrayList forEach().