Check out example codes for "How to loop through objects in java using streams". It will help you in understanding the concepts better.

Code Example 1

ArrayList<String> namesList = new ArrayList<String>(Arrays.asList( "alex", "brian", "charles") );
         
namesList.forEach(name -> System.out.println(name));

Learn ReactJs, React Native from akashmittal.com