How to fill a two Dimensional ArrayList in java with Integers?

Posted by eNetik on Stack Overflow See other posts from Stack Overflow or by eNetik
Published on 2011-02-16T22:17:46Z Indexed on 2011/02/16 23:25 UTC
Read the original article Hit count: 168

Filed under:
|

I have to create a 2d array with unknown size. So I have decided to go with a 2d ArrayList the problem is I'm not sure how to initialize such an array or store information.

Say I have the following data

   0 connects 1
   2 connects 3 
   4 connects 5

....etc up to a vast amount of random connections

and I want to insert

true(1) into [0][1], 
true(1) into [2][3], 
true(1) into [4][5]. 

Can the array automatically update the column/rows for me

Any help is appreciated thanks

© Stack Overflow or respective owner

Related posts about java

Related posts about arraylist