Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-20-2008, 08:55 AM
Member
 
Join Date: Jan 2008
Posts: 17
gapper is on a distinguished road
2 dimensional Lists
As we know, simple arrays can be of multi dimensions. Can an ArrayList/Vector be of 2 dimensional? Please dive code samples.

Thanks in advance
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-20-2008, 09:57 AM
roots's Avatar
Moderator
 
Join Date: Jan 2008
Location: Dallas
Posts: 251
roots is on a distinguished road
How about Vector of Vector

Code:
Vector<Vector<String>> twoDimensionalVector ;
__________________
dont worry newbie, we got you covered.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 01-20-2008, 09:57 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 750
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
This can probably lead to confusing code down the road, and I would hope someone might have something better but you can try this:
Code:
ArrayList< ArrayList<String> > my_2dlist = new ArrayList< ArrayList<String> >(); my_2dlist.add( new ArrayList<String>() ); my_2dlist.get(0).add("Hello, World"); System.out.println(my_2dlist.get(0).get(0));
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on July 13, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 01-20-2008, 09:58 AM
roots's Avatar
Moderator
 
Join Date: Jan 2008
Location: Dallas
Posts: 251
roots is on a distinguished road
lol captain .. what a timing ..
__________________
dont worry newbie, we got you covered.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 01-20-2008, 10:01 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 750
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Heh, jinx!
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on July 13, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to initialize a two dimensional Array Java Tip java.lang 0 04-14-2008 09:48 PM
Need help with a program for high school regarding multi-dimensional arrays. Torque New To Java 2 01-07-2008 08:45 PM
Adding numbers in a 2 dimensional array j0shizabeast New To Java 2 11-27-2007 05:31 AM
Help with array multi-dimensional barney New To Java 1 07-31-2007 09:00 PM
Tudu Lists 2.0 JavaBean Java Announcements 0 07-11-2007 04:32 PM


All times are GMT +3. The time now is 11:37 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org