Skip to content

Instantly share code, notes, and snippets.

@melastmohican
Created March 2, 2017 05:06
Show Gist options
  • Save melastmohican/b63172a49914a3560fcd644df2eb07c1 to your computer and use it in GitHub Desktop.
Save melastmohican/b63172a49914a3560fcd644df2eb07c1 to your computer and use it in GitHub Desktop.
Reverse string in Java 8
class ReverseString {
public static void main(String[] args) {
System.out.println("Hello World".chars().mapToObj(i -> Character.toString((char)i)).reduce("", (a, b) -> b + a));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment