We would like to know how to pass Consumer as Lambda.
/*from w w w . j a va 2s . com*/ import java.util.function.Consumer; public class Main { public static void main(String[] args) { sayBrand(e -> System.out.println("Car's Brand: " + e), "Audio A6"); } public static void sayBrand(Consumer<String> block, String param) { block.accept(param); } }
The code above generates the following result.