Check out example codes for "inline foreach java". It will help you in understanding the concepts better.

Code Example 1

names.forEach(name -> System.out.println(name));

Learn ReactJs, React Native from akashmittal.com