|
-
August 21st, 2009, 11:56 AM
#1
TreeMap of Vector
Hello, my situation is this; I would like add element (integer that represent indexes in another Vector) in freqToIndex.Vector;
Code:
SortedMap <Integer, Vector< Integer> > freqToIndex= new TreeMap < Integer, Vector< Integer > >();
void foo() {
//_word is another vector
this.freqToIndex.put( totalFreq, freqToIndex.previuosVector.add (_words.size() -1 );
}
I don't undertand how to access to the Vector inside the TreeMap. This is my problem at moment...
Any help, please?
thanks,
Last edited by mickey0; August 21st, 2009 at 12:00 PM.
-
August 21st, 2009, 01:01 PM
#2
Re: TreeMap of Vector
You have to retrieve the vector by the get method of the map which is referenced by an integer.
Code:
Integer rowToRetrieve = null;
/* set the rowToRetrieve for example */
/* This is my vector. so I can just method chain to act on it */
this.freqToIndex.get(rowToRetrieve).add(_words.size() -1);
Another way to look at it is
Code:
Vector<Integer> myVector = this.freqToIndex.get(rowToRetrieve);
myVector.add(_words.size() -1);
Last edited by Deliverance; August 21st, 2009 at 01:14 PM.
------
If you are satisfied with the responses, add to the user's rep!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|