Java examples for Lambda Stream:Lambda
The following lines of code demonstrate a functional interface that contains a single method declaration.
public class Main { public static void main(String[] args) { ReverseType newText = (testText) -> { String tempStr = ""; for (String part : testText.split(" ")) { tempStr += new StringBuilder(part).reverse().toString() + " "; }/*from w ww . j ava 2 s .co m*/ return tempStr; }; System.out.println(newText.reverse("HELLO WORLD")); } } @FunctionalInterface interface ReverseType { String reverse(String text); }