DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 3 of 3
  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...

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
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links