Results 1 to 2 of 2

Thread: Multidimensional ArrayList in Java

  1. #1
    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

  2. #2
    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.

Similar Threads

  1. Multidimensional ArrayList in java
    By Aaliya Seth in forum Software Development
    Replies: 6
    Last Post: 16-02-2011, 01:03 AM
  2. ArrayList Collection problem in java
    By Bricklayer in forum Software Development
    Replies: 4
    Last Post: 23-07-2010, 01:18 PM
  3. How to sort items of an ArrayList in java?
    By hounds in forum Software Development
    Replies: 4
    Last Post: 06-02-2010, 07:46 PM
  4. Problem in modifying value of ArrayList Object of JAVA
    By Praetor in forum Software Development
    Replies: 3
    Last Post: 16-11-2009, 09:58 AM
  5. How to implement MultiDimensional Array in JAVA
    By Nihar Khan in forum Software Development
    Replies: 3
    Last Post: 28-02-2009, 01:25 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,750,328,659.23032 seconds with 16 queries