/expressions

Lambda fun

Primary LanguageJavaMIT LicenseMIT

expressions

Playing with Java8. Here's Try as an Expression. More Examples

    @Test public void should_return_try_value() {
        String result = Try(() -> {
            return "try";
        }).Catch(NullPointerException.class, e -> {
            return "catch";
        }).apply();

        assertEquals("try", result);
    }