Created
January 24, 2015 05:45
-
-
Save why-jay/9d03b1b1e1c770e2a5af to your computer and use it in GitHub Desktop.
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
List<Runnable> actions = new ArrayList<Runnable>(); | |
for (int counter = 0; counter < 10; counter++) | |
{ | |
final int copy = counter; // notice the `final` keyword! | |
actions.add(() -> { System.out.println(copy); }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment