Java Lambda
Expression Example: Foreach Loop
package govind;
import java.util.ArrayList;
import java.util.List;
public class ListDemo {
public static void
main(String[] args) {
List<String>
l=new ArrayList<>();
l.add("govind");
l.add("ballabh");
l.add("khan");
l.add("java");
l.add("technology");
l.forEach((n)->System.out.println(n));
}
}
o/p:-------------------------------
govind
ballabh
khan
java
technology
No comments:
Post a Comment