   Java - 2D ArrayList
  Simple question, but how I do 2D ArrayList in Java? I'v tried some way but nothing works.   
  it's been a while since i've touched java (no reason for me to do so):ArrayList< ArrayList<YourType> > l = new ArrayList< ArrayList<YourType> >(...);.....;  You first need to import java.util.ArrayList (or java.util.*).To create, you simply put ArrayList name = new ArrayList(); It's a good idea to create arraylists with types as suggested above since it means that if you add the wrong type into the list, the compiler will detect it. ArrayList<type> name = new ArrayList<type>();   ;  I'm not sure if you already solved your problem, but if not this might be of some help. The other two answers you got are only good if you have Java 1.5, which is the first version of Java that supports Generics.If you still use Java 1.4 or below you'll get an two dimensional ArrayList like this:int dimensionX = 3;int dimensionY = 3;ArrayList twoDimList = new ArrayList(dimensionX);for(int x = 0; x < dimensionX; x++){   twoDimList.add(new ArrayList(dimensionY));}Please note that the number you pass to the constructor is not the size of the ArrayList, but Java will use this as initial size. If you know the size of your Arraylist this is faster than giving no value.   ;Quote:Original post by RinusMaximusI'm not sure if you already solved your problem, but if not this might be of some help. The other two answers you got are only good if you have Java 1.5, which is the first version of Java that supports Generics.Everyone should use Java 5 unless there are very good reasons for not doing so, like having software in maintenance mode, which is not the case of the people in the "beginners" section of this site.