Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Iterator and Vector  RSS feed

 
Biju Philip NYC
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here's the scenario:
Vector a has elements {1, 5, 6}
Vector b has unique random integers {1, 34, 5, 6, 3, 8, 9, 11, 92, 13, 15, 44}.
The number of integers in b is equal to the sum of the elements in vector a.
I would like to create a HashMap like the following:
key value
X {1}
Y {34, 5, 6, 3, 8}
Z {9, 11, 92, 13, 15, 44}
Each value in the HashMap exists in a vector. The values are assigned (in this case) by taking the first element in b, then the next 5, and then the last 6 (1, 5, and 6).
Anyone know how I might be able to do this with the fastest performance? (Does not have to be synchronized). The keys to the hash are unique, but arbitrarily chosen.

------------------
 
Michael Ernest
High Plains Drifter
Sheriff
Posts: 7292
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Biju -
I am going to move this topic to the Performance forum, where it seems better suited. For future reference, those guys and the people in Meaningless Drive seem to enjoy solving other people's homework.
Would you also please reregister without using the NYC suffix in your name? We ask that each participant in the technical forums post using their real and proper name, so that the site maintains a professional appearance.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!