Java examples for Lambda Stream:Consumer
Declare Consumer function via Lambda
import java.util.function.Consumer; public class ConsumerDemo { public static void main(String[] args) { Consumer<String> s = (String name) -> System.out.println("Your Name:" + name); s.accept("Aman"); s.accept("Aman1"); }//from w ww . j a v a 2s . c om }