Last active
December 24, 2017 03:46
-
-
Save lgsantiago/b75a130a1dcc0858ebe803ab8345ee27 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| interface MyString { | |
| String myStringFunction(String str); | |
| } | |
| public static void main (String args[]) { | |
| // Block lambda to reverse string | |
| MyString reverseStr = (str) -> { | |
| String result = ""; | |
| for(int i = str.length()-1; i >= 0; i--) | |
| result += str.charAt(i); | |
| return result; | |
| }; | |
| // Output: omeD adbmaL | |
| System.out.println(reverseStr.myStringFunction("Lambda Demo")); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment