Questions tagged [multimap]

A container similar to a map but allowing duplicate keys

Use this tag for questions about associative arrays with non-unique keys, such as the std::multimap container in the C++ standard library, or scala.collection.mutable.MultiMap in Scala.

See the Wikipedia article for more information.

773 questions
0
votes
1 answer

Getting sortedArray of values from a HashMultiMap

i have two hashmultimaps . how do i compare the values of the multimap for a given key. i thought i would generate a TreeSet from HashMultiMap something like ts1=new TreeSet(hmap.get(key)) ts2=new TreeSet(hmap.get(key)) and then iterate over one…
Alvin
  • 387
  • 4
  • 7
  • 18
0
votes
0 answers

Multimap insertion crashes after 1 insert

I am writing a program that is a spellchecker, which implements a crude version(for simplicity) of soundexing an incorrectly spelled word. GOAL: While iterating a SET, which holds all the words in a dictionary, a soundex code is generated, then…
0
votes
1 answer

Writing and reading ListMultimap in file

I tried writing ListMultimap to file using Properties, but it seems impossible, refer to question Writing and reading ListMultimap to file using Properties. Going ahead, if using Properties to store ListMultimap is not correct way, how can we store…
N D Thokare
  • 1,703
  • 6
  • 35
  • 57
0
votes
0 answers

Writing and reading ListMultimap to file using Properties

How can I write and read ListMultimap to file using Properties? I have an index as follows: ListMultimap index = ArrayListMultimap.create(); and writing index to file using Properties as…
N D Thokare
  • 1,703
  • 6
  • 35
  • 57
0
votes
1 answer

Convert ListMultimap to list of keys with duplicates?

So I have a ListMultimap that I want to convert to a List that contains duplicates of the same Integer if there was >1 value associated with a Integer key in the ListMultimap. For instance, if: ListMultimap
r123454321
  • 3,323
  • 11
  • 44
  • 63
0
votes
3 answers

I got a identical Key twice in a multimap, it just exists one in the textfile.

i have an issue with multimap. I read a file, that stores Years and Temepratures for everymonth. 2011 9.23 3.23 4.23 and so on. Now i want to write the average temperature from each year back to a file. I used a multimap. The double stores…
d0zer
  • 235
  • 1
  • 4
  • 9
0
votes
1 answer

ListMultimap asMap() -- modification while iterating?

So I have a ListMultimap> containerSizeToDestQuanMap. I am trying to iterate through it as follows: Map>> sourceMapConverted = this.containerSizeToDestQuanMap.asMap(); for…
r123454321
  • 3,323
  • 11
  • 44
  • 63
0
votes
1 answer

Map XML content with XSLT

I am trying to list all the nodes which contains a child node which of a certain id. Take this example xml:
Theodor
  • 5,536
  • 15
  • 41
  • 55
0
votes
1 answer

hash_multimap find not working the way it should

I've been trying to use a hash_multimap for sometime now, but the find method keeps giving me a iterator to the end of the container even though I know it found a matching key. What has me confused is that I've used the same code before for a…
Qdot543
  • 51
  • 1
  • 8
0
votes
1 answer

How to populate a mapped multimap?

I have the following mapped multimap : map>> modCreAlt; I am trying to insert a line in it : int priority = ... ; string alertInv = ... ; string upperAlertInv = ... ; modCreAlt.insert(make_pair(42,…
Pierre Espenan
  • 3,996
  • 5
  • 33
  • 51
0
votes
1 answer

how to link data in multiple multimaps together (C++)?

I am storing data in 2 multimaps. The data is a struct the consists of 6 variables: struct data { int var string var string var string symbol int price int var }; Now I need to sort the data in the multimaps by symbol. If…
OGH
  • 540
  • 1
  • 4
  • 15
0
votes
2 answers

reverse multimap in java

I have a multimap and I iterate it with hasnext(). Set keySet = myMap.keySet(); Iterator keyIterator = keySet.iterator(); while (keyIterator.hasNext() ) { Integer key = (Integer) keyIterator.next(); …
user2181255
  • 11
  • 1
  • 3
0
votes
2 answers

Iterate over equal_range result set

I have the following unordered multimap: std::tr1::unordered_multimap duplicates; And I try to get the values of a key using std::pair
glarkou
  • 7,023
  • 12
  • 68
  • 118
0
votes
2 answers

Traverse MultiMap to Find Path from a Given Value to a Given Key

Details: I have a multimap implementation that represents the adjacency list for the subset of a graph. I need to find a path through this subset of the graph, which is actually all the possible paths from a start node F to an end node G, acquired…
frankV
  • 5,353
  • 8
  • 33
  • 46
0
votes
2 answers

change values of multiple elements in std::multimap by key

I am using a std::multimap std::multimap map; It contains elements below 1 2 2 3 3 2 1 2 1 0 I want to replace all 1's and 2's by X. I searched in google for a long time, but didn't get the result. I tried…