Thursday, 18 May 2017

Java Tutorial: Lambda expression in java | Java Lambda expressions[Lambda expression-foreach loop]


Click here to watch in Youtube : 
https://www.youtube.com/watch?v=Cmrrk7D_-bM&list=UUhwKlOVR041tngjerWxVccw

LambdaDemo.java
import java.util.ArrayList;
import java.util.List;

/**
 * 
 * Java Lambda Expression Example: For-each Loop
 *
 */
public class LambdaDemo
{

    public static void main(String[] args)
    {
        List<String> nameList = new ArrayList<String>();
        nameList.add("Ram");
        nameList.add("Peter");
        nameList.add("John");

        nameList.forEach((name) -> System.out.println(name));
    }

}
Output
Ram
Peter
John
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/LambdaDemo_for_each_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/LambdaDemo_for_each_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/539015917c8406e4be671410d713073b3971d1a5/BasicJava/LambdaDemo_for_each_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • No comments:

    Post a Comment