Preview:
//ReverseStringLambda
public class ReverseStringLambda {
    @FunctionalInterface
    interface StringReverser {
        String reverse(String str);
    }
    public static void main(String[] args) {
        StringReverser reverser = (str) -> new StringBuilder(str).reverse().toString();
        String example = "Hello, World!";
        String reversed = reverser.reverse(example);
        System.out.println("Original: " + example);
        System.out.println("Reversed: " + reversed);
    }
}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter