File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes ArrayList Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "ArrayList" Watch "ArrayList" New topic


kalai sundar
Ranch Hand

Joined: May 25, 2005
Posts: 69
int[][] a = new int[][], array size u just conside some value.
Here bno, Row,Tier are 2D Arrays
for(int i=0;i<bno.lenght();i++){
for(int j=0;j<Row[i].lenght;j++){
for(int k=0;k<Tier[i].lenght;k++)
a[i][j] = Row[i][j].concat(Tier[i][k]



if i want to do the same thing in array list, how i can i do? For example if bno,Row,Tier are 2D Arraylist, how i can do the above mentioned operation, plz hepl me with example
Stephen Huey
Ranch Hand

Joined: Jul 15, 2003
Posts: 618
Just create a List of List objects. For example, to have a List containing 10 Lists inside of it, do this:

So then, if I had an Integer myNumber and I wanted to insert it into the 4th element of the 7th List inside of outer, I'd do this:

But be careful not to generate an exception by adding something beyond the bounds of the list. You can get around this by using the ArrayList constructor that takes an initialCapacity, or more likely, you'll simply be calling the add() method each time to add onto the end of the List rather than explicitly setting a value at a particular point in the List.
I agree. Here's the link:
subject: ArrayList
jQuery in Action, 3rd edition