Use Function Lambda - Java Lambda Stream

Java examples for Lambda Stream:Function

Description

Use Function Lambda

Demo Code



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);
  }

}

Related Tutorials