Skip to content

Instantly share code, notes, and snippets.

@idefixcert
Created April 28, 2013 12:39
Show Gist options
  • Save idefixcert/5476772 to your computer and use it in GitHub Desktop.
Save idefixcert/5476772 to your computer and use it in GitHub Desktop.
Fast ArrayList Initialization
private static String[] array = new String[]{"Test", "Test"};
private static List<String> arraylist = new ArrayList<String>() {
{
add("Test");
add("Test");
}
};
private static Map<String,String> map = new HashMap<String,String>() {
{
put("one","Test");
put("two","Test");
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment