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
-1
votes
2 answers

c++ multimap insert more than two values

I have found that it's possible to declare such std::multimap: multimap < u_int32_t, u_int32_t,string> lines; If it's possible to declare it then it should be possible to insert too But I wonder how? I have tried std::pair, but it seems I need…
Tebe
  • 3,176
  • 8
  • 40
  • 60
-1
votes
1 answer

Issue with C++ B-tree

I am using the Google's C++ B-tree and I have an issue that someone might be able to answer. First of all I get the following error: In file included from ref_impl/../include/btree_map.h:31:0, from…
glarkou
  • 7,023
  • 12
  • 68
  • 118
-1
votes
1 answer

How to print from a multimap

Hey im trying to print out from a multimap. My multimap is: multimap map; What i want to happen is when im calling a question: questions.printQuestion(1); Its prints out the 3 questions in random order. But all im getting so far…
-1
votes
1 answer

Arraylist mapped to Hashmap

While parsing a JSON file something like this: { "heading1" : [ { "heading2" : { "subhead2" : { "value" : "value" } }, "heading3" : [ { "heading4" : { "subhead4" :…
curlyreggie
  • 1,530
  • 4
  • 21
  • 31
-2
votes
1 answer

Iterate over all the elements in a std::multimap with the same key

I want to add objects so a multi-map and some should have the same key how can I get access to all the elements which the same key? Can I do a ranged fore lope over only the specific keys or something similar?
Isak True
  • 13
  • 2
-2
votes
3 answers

Multimap implementation with duplicate keys

I have a function which returns an array list in the following way [java.lang.String=name, int=parameters, byte=paramOne, java.lang.String=format, byte=paramTwo] and is stored in a variable like : List> dataTypes Now I want to…
R2D2
  • 23
  • 1
  • 7
-2
votes
2 answers

std::distance is slow and how to improve it?

std::distance seems to be very slow. I have a large multimap and try to use equal_range to find the element with common key: auto range = in_map.equal_range(neuron_with_spikes[i]); int count = std::distance(range.first, range.second); The…
David
  • 325
  • 2
  • 12
-2
votes
4 answers

How to merge two ArrayList> to one?

ArrayList> result1 result1 is like (1, a) (2, a) (3, b) (4, e) (5, e) ArrayList> result2 result2 is like (1,android) (2,ios) (3,android) (4,android) (5,ios) I want to merge the two maps to build a map like…
DavidW
  • 33
  • 6
-2
votes
1 answer

I need to create MultiMap using hash-table but I get time-limit exceeded error (C++)

I'm trying to solve algorithm task: I need to create MultiMap(key,(values)) using hash-table. I can't use Set and Map libraries. I send code to testing system, but I get time-limit exceeded error on test 20. I don't know what exactly this test…
-2
votes
1 answer

How to print words using reverse_iterator in STL

I have to read two text files and then compare words from second file with the first one. Then , I have to display KnownWords which are same words from both files and the remaining words which are not same are UnknownWords. Next Step is, I have to…
muzzi
  • 382
  • 3
  • 10
-2
votes
1 answer

Java iterating over values of Multimap

I have a Multimap where each key gets a variable number of values assigned to it. In case there are multiple values in 1 key, I want to do operations with the values. It was easy to find online how to iterate over the keys in a Multimap, but can't…
blah_crusader
  • 424
  • 1
  • 5
  • 14
-2
votes
1 answer

About multimap, which of the following can be compiled successfully?

The answer is the first one but I don't know why. Can anybody analyse each one?
user7487638
  • 151
  • 8
-2
votes
1 answer

Node.js - Multimap

I have the following data(example) - 1 - "Value1A" 1 - "Value1B" 1 - "Value1C" 2 - "Value2A" 2 - "Value2B" I'm using Multimaps for the above data, such that the key 1, has 3 values(Value1A, Value1B, Value1C) and key 2 has 2 values(Value2A,…
user2636368
  • 622
  • 4
  • 10
  • 20
-2
votes
1 answer

Is there a way to have a map like ArrayListMultimap but with RangeSet and "coalescing" instead?

I want a map which assignes RangeSets to Integers in a way that instead of: Map sensorIDsWithTimeRange = new HashMap<>(); if (sensorIDsWithTimeRange.containsKey(sensorId)) { …
Defozo
  • 2,946
  • 6
  • 32
  • 51
-2
votes
1 answer

Creating multimap of structs

I am trying to create an multimap of structs , i have declared a struct struct Student{ Student(){}; Student( string n , int a ){ name = name; age = age; } string name; int age; } created a multimap multimap< string ,…
user3706129
  • 229
  • 4
  • 15
1 2 3
51
52