Created
March 2, 2017 05:06
-
-
Save melastmohican/b63172a49914a3560fcd644df2eb07c1 to your computer and use it in GitHub Desktop.
Reverse string in Java 8
This file contains 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
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