ArrayList Problem


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: ArrayList Problem

  1. #1
    Join Date
    Sep 2003
    Posts
    36

    ArrayList Problem

    I am using and Arraylist for sor soil samples because I don't know the number of samples and the depth of each sample. I am having a problem setting up my Arraylist and would appreciate some help.

    In general the sample can be handled with a two diminsional array.

    int[][] layerdepth = new int[][]; // where layerdepth[sample number
    unknow][depth unknow]

    int[][] watercapity = new int[][]; // where water capacity[sample number
    unknow][depth unknow]

    I thought I could add this to an Arraylist By:

    ArrayList asoildata = new Arraylist;
    asoildata.add(sample number, layerdepth);

    But it will not work. I need to retrieve data by sample number, and suggestions would be appreciated.

    Thanks...Ronnie

  2. #2
    Join Date
    Jun 2004
    Posts
    14
    There aren't really multi-dimensional arrays in Java, just arrays of arrays. So you should get the desired behaviour with an ArrayList of ArrayLists (though without the convenient regular array notation).

  3. #3
    Join Date
    Sep 2003
    Posts
    36
    Thanks...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center