FAQ Database Discussion Community


Multimap Iterator retrieve multiple values in Java [closed]

java,iterator,multimap
Is there a way to access each value to assign it to a variable from a java MultiValueMap from Apache commons while iterating? I have one key and two possible values that I would like to extract each iteration that are later written to a table. Currently the below produces...

Postgresql merge rows with same key (hstore or json)

json,postgresql,multimap,hstore
I have a table like this: +--------+--------------------+ | ID | Attribute | +--------+--------------------+ | 1 |"color" => "red" | +--------+--------------------+ | 1 |"color" => "green" | +--------+--------------------+ | 1 |"shape" => "square" | +--------+--------------------+ | 2 |"color" => "blue" | +--------+--------------------+ | 2 |"color" => "black" | +--------+--------------------+ | 2...

map/set iterator not dereferencable. Multimap container isse

c++,graph,multimap
I'm geting this error message map/set iterator not dereferencable When trying to get value by key in multimap. In this code I'm trying to show nonoriented graph represented by adjacency list (vector<Vertex*> vertexList) void NonOrGraph::show() { cout << endl; multimap<int, int> used; for (int i = 0; i < vertexList.size();...

print deque containing multimap

c++,multimap,deque
I would need to print a dequeu containing a multimap, but it's not working, what am I doing wrong? int main() { deque<multimap<string,int> > q_map; multimap<string,int> m; m.insert(pair<string, int>("a", 1)); m.insert(pair<string, int>("c", 2)); m.insert(pair<string, int>("b", 3)); m.insert(pair<string, int>("b", 4)); m.insert(pair<string, int>("a", 5)); m.insert(pair<string, int>("b", 6)); cout << "Map size: "...

Peculiar behaviour while erasing an element from from std::multimap

c++,c++11,stl,multimap
I was trying to remove an element from a std::multimap while I am looping over it in a thread that manipulates it . I used erase function in the following ways When I do this //mItr is base iterator which loops over the multimap std::multimap<std::string, std::string>::iterator tmpItr = ++mItr; healthyQ.erase(mItr);...

How to store ListMultimap values in individual arraylists

java,multimap
/* Sample code*/ ListMultimap<String, String> m =ArrayListMultimap.create(); for (String test:m.keySet()) { BaseTest.getLogger().info("Mapped elements:"+ test +"-->"+ m.get(test) ); } I want to store m.get(test) values in three individual arraylists or array of arraylist, so that i can access them using list.get(1) like..this...any suggestions??...

Segmentation fault with Sun c++ compiler

c++,segmentation-fault,multimap,cc
I have a class AccountMap in AccountMap.h and AccountMap.cpp. It reads stuff from a binary file (which is ok) and outputs stuff. It runs perfectly fine on g++ compiler but gives me a seg fault on sun c++ CC compiler when I use new operator for the 10 iteration in...

Iterating over Guava Mutlimaps

java,collections,guava,multimap
Is there a way to get a Key-Value pair of each element in a MultiMap in each iteration, without first adding them to a list? I'd like to implement something like this: (I know this will not work) public class MutliMapTest { public static void main(String... args) { Multimap<String, String>...

Swapping relation of keys and values in a Google Guava Multimap

java,guava,relation,multimap
I have a Multimap<String, Integer> map = ... where I can do map.get("somekey") to retrieve all the matching Integers. Now I would like to find the keys that have a given Integer, i.e. something like a Collection<String> keys = map.getByValue(Integer.of(4)) which returns all keys in the Multimap where the given...

NullPointerException caused by Reading from File used for indexing using Google Guava [duplicate]

java,indexing,guava,bufferedreader,multimap
This question already has an answer here: What is a Null Pointer Exception, and how do I fix it? 12 answers I am working with Google Guava to use a Multimap like this for example {S1.E11=[S2.E236], S1.E108=[S2.E371]} . But I have a problem. I want to read from file...

How to give different array list for each key when implementing HashMap>

java,dictionary,arraylist,hashmap,multimap
I want to have a different array list for each key when I use HashMap>. I would like to store the sentence id as a key and words of the sentence in array list. To do that I did the following: //I used the multimap for this task and it...

How can I overload equal method to make different objects have same hashcode value in unordered_multimap in my case

c++,hashcode,multimap
I have written a map like this: unordered_multimap<Point, int, StrHash, StrCompare> map StrHash() is to create hashcode and StrCompare() is to solve the hashcode collision. but I want to do something as follow: A and B have different hashcode value,but A equal to B, then run the StrCompare() method. how...

Reading Multimap with composite key including null field

java,collections,guava,multimap
I have a Multimap to store some data with composite key (data type, data id). Here is my code: public class Data { private final String type; private final Integer id; private final String information; public Data(String type, Integer id, String information) { this.type = type; this.id = id; this.information...

Using boost::iostreams::mapped_file_source with std::multimap

c++,boost,memory-mapped-files,multimap
I have a rather large amount of data to analyse - each file is about 5gigs. Each file is of the following format: xxxxx yyyyy Both key and value can repeat, but the keys are sorted in increasing order. I'm trying to use a memory mapped file for this purpose...