Skip to content

Instantly share code, notes, and snippets.

@zkxs
Last active August 29, 2015 14:27
Show Gist options
  • Save zkxs/d5cde333225af88e4b7d to your computer and use it in GitHub Desktop.
Save zkxs/d5cde333225af88e4b7d to your computer and use it in GitHub Desktop.
Double Brace Initialization
import java.util.*;
class Braces {
public static void main(String[] args) {
List<String> list = new ArrayList<String>(){{
add("michael");
add("was");
add("here");
}};
for (String s : list) {
System.out.print(s + " ");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment