Skip to content

Instantly share code, notes, and snippets.

@lgsantiago
Last active December 24, 2017 03:46
Show Gist options
  • Select an option

  • Save lgsantiago/b75a130a1dcc0858ebe803ab8345ee27 to your computer and use it in GitHub Desktop.

Select an option

Save lgsantiago/b75a130a1dcc0858ebe803ab8345ee27 to your computer and use it in GitHub Desktop.
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