Created
June 30, 2013 04:37
-
-
Save mike-neck/5893871 to your computer and use it in GitHub Desktop.
AutoCloseableで遊んでた
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
public class AutoClosableExpression { | |
public static void main(String... args) { | |
try (LambdaClosable closable = () -> { | |
System.out.println("\(^o^)/オワタ"); | |
}) { | |
closable.doSomething("(´・ω・`)"); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
static interface LambdaClosable extends AutoCloseable { | |
default public void doSomething (String something) { | |
System.out.println("doing " + something); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment