By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,806 Members | 1,380 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,806 IT Pros & Developers. It's quick & easy.

How to use three diementional arraylist in java for insert and retrive values?

Suresh Mahesh
P: 9
i have to store and retrieve integer value from three dimensional array recursively.
For example i have a=1,b=2,c=3 and a=3,b=2,c=1 and a=1,b=2,c=3 etc as input .

then i should get output of all rows and columns in three dimensional array list

i tried this i am getting error as index=1 size=1

Expand|Select|Wrap|Line Numbers
  3. result.add(new ArrayList<Integer>());
  6.           ((ArrayList) result.get(row)).add(bin);
  7.           ((ArrayList) result.get(row)).add(total_waste);
  8.           ((ArrayList) result.get(row)).add(aa.size());
  10.        System.out.println(((ArrayList) result.get(row)).get(0) + "  ");
  11.        System.out.println(((ArrayList) result.get(row)).get(1) + "  ");
  12.       System.out.println(((ArrayList) result.get(row)).get(2) + "  ");
Aug 22 '12 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.