newbie question on 2 dim arraylist

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi ,
Is it possible to define a two dimensional arraylist ? if so how?

Many Thanks
 
Hi,
nope, not natively like arrays, but you could have an arraylist of
arraylist if you want which simulates a 2D array i.e.

ArrayList list = new ArrayList();

for(int i=0; i<10; i++)
{
list = new ArrayList();
}


Now you can access the arraylist like a 2D object i.e. object x = list[x][y];

Hope that helps
Mark Dawson
http://www.markdawson.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top