Skip to content

Instantly share code, notes, and snippets.

@Romain-Geissler
Created June 12, 2012 21:06
Show Gist options
  • Save Romain-Geissler/2920140 to your computer and use it in GitHub Desktop.
Save Romain-Geissler/2920140 to your computer and use it in GitHub Desktop.
Array og generics in java
all:Test.class
test:all
java Test
%.class:%.java
javac '$<'
import java.util.ArrayList;
public class Test{
public static void main(String[] arguments){
IntegerArrayList[] lists=new IntegerArrayList[2];
lists[0]=new IntegerArrayList();
lists[0].add(new Integer(42));
lists[0].add(new Integer(53));
lists[1]=new IntegerArrayList();
lists[1].add(new Integer(420));
lists[1].add(new Integer(530));
for(IntegerArrayList list:lists){
System.out.println("--------------------");
for(Integer element:list){
System.out.println(element);
}
System.out.println("--------------------");
}
}
}
class IntegerArrayList extends ArrayList<Integer>{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment