Skip to content

Instantly share code, notes, and snippets.

@kmb385
Created November 27, 2013 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kmb385/7681956 to your computer and use it in GitHub Desktop.
Save kmb385/7681956 to your computer and use it in GitHub Desktop.
Array with component type that is a parameterized type
public class ArrayStoreCheck {
/**
* @param args
*/
public static void main(String[] args) {
LinkedList integers = new LinkedList<Integer>();
integers.add(1);
LinkedList<String> strings = new LinkedList<String>();
LinkedList<String>[] lists = new LinkedList[20];
lists[0] = strings;
lists[1] = integers;
strings.add("Hello");
System.out.println(lists[0].get(0));
System.out.println(lists[1].get(0));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment