778 questions
1
vote
1
answer
140
views
Are the map/multimap iterators interchangeable?
In the code below I'm defining a map and a multimap. Then I'm defining four iterators assigning them values from these containers:
std::map<int, double> m;
std::multimap<int, double> mm;
...
0
votes
0
answers
30
views
How to call existing function on value of ImmutableListMultimap instead of Map
I currently have this function:
ImmutableMap<String, ImmutableList<ImpactSummary>>
toSummariesByKey(ImmutableMap<String, ImmutableList<Impact>> impactsByKey)
return ...
0
votes
2
answers
113
views
Filter entries in Multimap to remove duplicates
I have a Google Guava MultiMap, namely com.google.common.collect.ArrayListMultimap, in Java that has a lot of entries. The entries are string, like this:
URL1=URL2
URL2=URL1
URL4=URL3
URL3=URL4
As ...
0
votes
1
answer
90
views
Need for lock on key when trying to update Multimap value
We have a use case where we are using the Hazelcast Multimap. We’re spawning one thread each for every element within the Collection for every key. For instance, if key1 has, say, 10 values, then we ...
0
votes
0
answers
58
views
Best structure of Multiple indexed map
Problem
Multiple indexed map :
A value has several key, that can be used to find the value in a short time (may be less than O(n)).
The key is NON-UNIQUE, which means key1: val1, key1: val2, key1: ...
0
votes
2
answers
76
views
How do I remove a specific item from my multimap?
#include <map>
#include <iostream>
int main()
{
std::multimap <int, int> map;
// insert the values in multimap
map.insert(std::make_pair(1, 10));
map.insert(std::...
0
votes
2
answers
213
views
How to calculate average from Collection of HashMap<String, Double>
I have a Collection of HashMap<String, Duble> which I am getting from multimap. I want to calculate the average on Maps values and calculate which Map key is having minimum average. The data ...
1
vote
1
answer
520
views
Finding a key-value-pair within a std::multimap with key of type int
I have a std::multimap<int, X*> where X is a user-defined type. I want to find a specific key-value-pair within this multimap (i.e. an iterator pointing to this pair).
(A) Complete Example:
#...
0
votes
1
answer
48
views
How to print the matching value of key from (Google Guava) Multimap?
I would like to print the matching value of key from multimap. So far I have been unsuccessful at it.
These are the line of code I got so far about it :
dictionaryGG.keys().forEach((key) -> {
...
1
vote
1
answer
880
views
Unmodifiable Multimap
Is there a way to create (/return) an unmodifiable Multimap?
I am using the Multimap of com.google.common.collect and need to create an unmodfiable Multimap, but I couldn't find a lib that has a ...
0
votes
2
answers
58
views
Keying an (unordered_)map using a multimap iterator
I'm building a software where one class is responsible to log info sources and commands (both are grouped as requests), where all requests are inserted inside a multimap, wherein the multimap is keyed ...
3
votes
1
answer
8k
views
What is the usage of std::multimap? [duplicate]
I've just started learning STL containers, and I cannot understand why std::multimap exists. With std::map, we can access values by user-defined keys, but with std::multimap we cannot do that as the ...
1
vote
2
answers
56
views
How to Store Different Values in with every loop in MultiMap in Java?
I want to store the values in following way:
With every loop we are fetching different values for key, value1 & value2. Like this, MultiMap-> (key, value1, value2)
I used list for pairing ...
0
votes
1
answer
158
views
JavaScript building a breadth-first tree from multimap (which data has cycles)
Prerequisites:
I have a general tree class with: myTree = new Tree(string), appendChildNode(node), createChildNode(string)->node, myTree.print() functions and myTree.name, myTree.children, myTree....
0
votes
1
answer
81
views
How in multimap run for range from to?
I need to go from the beginning +3 and from the end -3
that is, if the total size is 10, then I have to iterate from 3 to 7
who it doesnt work?
std::multimap<int,int> _multimap;
for(auto it = ...
0
votes
3
answers
599
views
Remove 'null' from LinkedListMultimap in Java
I have the below code, and I want to remove the 'null' values when printing or saving in a file.
There are times I don't have to pass any values to a variable. So, in those cases, I need the keys ...
2
votes
1
answer
62
views
Why is Multimap not writing all values at one index to a text file? [closed]
I am simply trying to write data from multimap to a text file in C++. My multimap contains two values at one key, although it outputs both values on the console, but it writes the key and value of the ...
0
votes
1
answer
297
views
C++: Why does only the key have to be const in a const std::pair?
I am relatively new to C++, and have only just discovered how to use maps and pairs.
When looping over a map I created, which holds voltage keys and time values, I declare the loop variable a const ...
1
vote
0
answers
805
views
Android Room Multimap with left join doesn't work
I'm using Room's new feature of MultiMap to join 2 tables as such:
@Query("""
SELECT comments.*, users.*
FROM comments
LEFT JOIN users ON comments.author_id = users.id
&...
4
votes
1
answer
512
views
Paging and Join in Room
I want to use paging in room But I can not. Because I use multimap and it return map. When I use these technology together, I get this error :
error: Not sure how to convert a Cursor to this method's ...
10
votes
1
answer
2k
views
Android Room Multimap issue for the same column names
As stated in official documentation, it's preferable to use the Multimap return type for the Android Room database.
With the next very simple example, it's not working correctly!
@Entity
data class ...
0
votes
1
answer
613
views
Java: 1 key with multiple values using data structure
I have a list of objects having code and user name. I can get the code and username with getCode() and getUserName(). I can think of using MultiMap if I must display only code and list of usernames ...
0
votes
1
answer
267
views
c++ std::multi_map iterating equal_range problem
I'm currently debugging some code and am confused as to how the following is possible:
void DoSomething(int cell, const std::multimap<int, const Foo*>& map) {
auto range = map.equal_range(...
1
vote
0
answers
26
views
How to ignore MultiMap class member to write in document DB azure
I have already tried this :
@JsonIgnore
Removed Lombok and manually written @JsonIgnore on getter and setter of property
My property looks like this :
public Multimap<String, String> ...
-1
votes
1
answer
701
views
Inserting a struct as a value in Multimap and Iterating the same to get the values
#include <stdio.h>
#include <map>
struct temp
{
int x;
int id;
};
int main()
{
temp t;
int key;
typedef std::multimap<int,struct temp> mapobj;
t.x = 10;
t....