Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Multidimensional ArrayList in Java

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 01-02-2011
Member
 
Join Date: Feb 2011
Posts: 1
Multidimensional ArrayList in Java
  

Hello,

I have an assignment and I need to use multidimensional ArrayList. I am not that familiar with ArrayList. I don't know how to set it up. I have to put values input by the user.

This is what i did so far:-

ArrayList <ArrayList <ArrayList <ArrayList <String>>>> items = new ArrayList <ArrayList <ArrayList <ArrayList <String>>>>();

System.out.println("Enter the item name you want to add in the trunk(without spaces): ");
String itemName = input.next();

System.out.println("Enter the item dimensions(in cubic feet, less than trunk's capacity i.e. " + trunkCapacity + "): ");
double itemDimensions = input.nextDouble();

System.out.println("Enter the weight of the item(in lbs, less than trunk's max maxx i.e. " + maxMass + "): ");
double itemMass = input.nextDouble();
items.add(itemName).add(itemDimensions).add(itemMass);

Can someone help me? Please

Thanks
Navp

Reply With Quote
  #2  
Old 05-02-2011
Member
 
Join Date: Jan 2006
Posts: 605
Re: Multidimensional ArrayList in Java

If you are good in C# then actually in C# u can make a dynamic multidimentional array with the following expression:

List<List<T>> matrix = new List<List<T>>(); T: is of any type

With that uyou save any time any amount of data.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Multidimensional ArrayList in Java"
Thread Thread Starter Forum Replies Last Post
Multidimensional ArrayList in java Aaliya Seth Software Development 6 16-02-2011 01:03 AM
ArrayList Collection problem in java Bricklayer Software Development 4 23-07-2010 01:18 PM
How to sort items of an ArrayList in java? hounds Software Development 4 06-02-2010 07:46 PM
Problem in modifying value of ArrayList Object of JAVA Praetor Software Development 3 16-11-2009 09:58 AM
How to implement MultiDimensional Array in JAVA Nihar Khan Software Development 3 28-02-2009 01:25 PM


All times are GMT +5.5. The time now is 05:42 PM.