Java examples for Lambda Stream:Consumer
Create Consumer Lambda with method reference
import java.util.function.Consumer; public class ConsumerFunctionalInterface { static void show(String name) { System.out.println("Name:" + name); }/*from w w w.ja v a2 s . com*/ public static void main(String[] args) { Consumer<String> consumer = ConsumerFunctionalInterface::show; consumer.accept("Aman"); consumer.accept("Sonu"); consumer.accept(null); consumer.accept("Raman"); } }