• Post Reply Bookmark Topic Watch Topic
  • New Topic

Regd Multidimensional arrays/collections  RSS feed

 
jha0147
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi How can I store arrays in a java collection
I mean I have lets say three string arrays
String [] one = {"a" , "b"};
String [] two = {"c" , "d"};
String [] three = {"e" , "f"};
Now I want to store this array in some java collection
so that I can iterate thru this and pass these arrays as arguments
ex : for(int i=0;i<collectionArray;i++)>
{
callFunction(collectionArray[i]);
}
I am somehow not able to do this.
how do I do this.

 
Nirvana_417
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make a Vector() and add these array objects into it !
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better even, make an ArrayList(), LinkedList(), HashSet(), or TreeSet()...
- Peter
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jha0147/Nirvana_417,
Please change your name to be compliant with JavaRanch's naming policy. Your ID should be 2 separate names with more than 1 letter each. We really want this to be a professional forum and would prefer that you use your REAL name.
Thanks,
-Peter
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!