Last active
June 7, 2016 15:24
-
-
Save deleter8/3a675aa70cb6cc933dda525223b11c68 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 MinifiedLambdaBehavior | |
static Runnable makeI() { return () -> {}; } | |
static Runnable makeII(String s) { return () -> s.equals(""); } | |
static Runnable makeIII() { return new Runnable() { public void run() {} }; } | |
@Test | |
public void thing() { | |
Set<Runnable> runnables = new HashSet<>(); | |
runnables.add(() -> {}); | |
runnables.add(() -> {}); | |
runnables.add(makeI()); | |
runnables.add(makeI()); | |
String s = ""; | |
runnables.add(makeII(s)); | |
runnables.add(makeII(s)); | |
runnables.add(makeIII()); | |
runnables.add(makeIII()); | |
System.out.println("Things created: " + runnables.size()); | |
} | |
} | |
//Outputs: | |
// Things created: 7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment