Results 1 to 2 of 2
Thread: 2D array inside a HashMap
- 03-22-2010, 11:42 PM #1
Member
- Join Date
- Jan 2010
- Posts
- 36
- Rep Power
- 0
2D array inside a HashMap
Hi everyone i would like to know how to access values stored in a 2D array inside a HashMap
Here is a drawing representation of the map.
So to get the KEYS I just have to execute this code:
But how can I get acces to the actual values inside the 2D Array?Java Code:this.allPeople = personInterests.keySet();
My goal is to create a treeSet and store all the elements of the first array in it, then look at the second array if any new elements are detected add them to the treeset, then third array and so on.
I tried this code:
ButJava Code:Object[] bands = personInterests.values().toArray(); for( int i=0; i<bands.length; i++) { this.allBands.add(bands[i].toString()); }
seems to be the problem, Dealing with a 2D array, this code only return a string representation of the Arrays and not a string representation of their elements.Java Code:this.allBands.add(bands[i].toString())
Using my logic I tried to execute:
But i get a ARRAY REQUIRED BUT JAVA.LANG.OBJECT FOUNDJava Code:this.allBands.add(bands[0][i].toString());
I really don't know the way to go.
Thanks to anyone that will help.
- 03-23-2010, 12:39 AM #2
Senior Member
- Join Date
- Mar 2010
- Posts
- 266
- Rep Power
- 4
Similar Threads
-
Something like HashMap
By BigBear in forum New To JavaReplies: 4Last Post: 03-14-2010, 11:08 AM -
How to create a new HashMap from a HashMap entries of other methods
By pandeyalok in forum Advanced JavaReplies: 7Last Post: 12-08-2009, 07:17 PM -
HashMap
By koolhoney in forum Advanced JavaReplies: 1Last Post: 03-30-2009, 08:08 PM -
hashmap
By tOpach in forum New To JavaReplies: 2Last Post: 09-24-2008, 12:55 PM -
string inside of a xml
By Heather in forum XMLReplies: 2Last Post: 03-28-2008, 05:21 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks