Java examples for Lambda Stream:Function
Use Function Lambda
import java.util.function.Function; public class BiFuncationMain { public static void main(String[] args) { doOperation((s)->s.length(), "Helllo"); doOperation((s)->s.split(" ").length, "Helllo Aman"); }// www . j a v a 2 s . c o m public static void doOperation(Function<String, Integer> function, String str) { int value=function.apply(str); System.out.println("Output::>"+value); } }