Java examples for Lambda Stream:Consumer
Use Consumer Lambda
import java.util.function.Consumer; public class ConsumerMain { public static void main(String[] args) { // We are passing a value to consumer and mention its behabiour print((a) -> System.out.println(a), "Hello"); }//from w w w . jav a2 s .com // Consumer consume value & return nothing public static void print(Consumer<String> s, String str) { str = str.toUpperCase(); s.accept(str); } }