multimap

Scala Immutable MultiMap

In Scala I would like to be able to write val petMap = ImmutableMultiMap(Alice->Cat, Bob->Dog, Alice->Hamster) The underlying Map[Owner,Set[Pet]] should have both Map and Set immutable. Here's a first draft for ImmutibleMultiMap with companion object: import collection.{mutable,immutable} class ImmutableMultiMap[K,V] extends immutab...

A multimap with good performance

In my code I have a map that is used heavily, several thousand times in a few seconds. Originally I had a TreeMap, but when testing with 9,000 entries I watched my old processor melt. And this needs to scale. So I moved to a HashMap and performance was excellent. Now I am changing my design and am looking for a MultiMap. However I'm afr...

iterator for map

hello i am trying to make a map containing objects as the following : class Employee >>dervied from Employee : are the following classes : Worker , Manager and ViceManage. in my map i want to have the object Employee sorted by his ID which is char* i tried to create a map like this:` multimap<const string,Employee*> t1 t1<string,Employe...

High-performance Concurrent MultiMap Java/Scala

Dear StackOverflow, I am looking for a high-performance, concurrent, MultiMap. I have searched everywhere but I simply cannot find a solution that uses the same approach as ConcurrentHashMap (Only locking a segment of the hash array). The multimap will be both read, added to and removed from often. The multimap key will be a String an...

How to check if my iterator stands on nothing

Hello, i'm using a multimap stl, i iterate my map and i did'nt find the object i wanted inside the map, now i want to check if my iterator holds the thing i wanted or not and i'm having difficulties with it because it's not null or something. thanx! ...

Is this use of nested vector/multimap/map okay?

I am looking for the perfect data structure for the following scenario: I have an index i, and for each one I need to support the following operation 1: Quickly look up its Foo objects (see below), each of which is associated with a double value. So I did this: struct Foo { int a, b, c; }; typedef std::map<Foo, double> VecElem; std...

implementing remove on a ConcurrentMultimap without races

I've been looking at the problem of writing a concurrent Multimap, and I have an implementation backed by the Google Guava AbstractSetMultimap and a MapMaker computing map that creates on demand the values-collections as a set view over a ConcurrentHashMap. With some care over the view collections and various wrappers, I think this gets ...

How to iterate through google multimap

I have to iterate through google multimap. But I am using jdk 1.4 and can't switch to higher version. So i can not use generic features. My multimap can have multiple values for a key. There might be a situation when a value of multimap is multimap in itself ...

Priority Queue using MultiMap - Java

Hi. I have to implement Priority Queue using MultiMap. I use MultiMap from Google Collections. The following code creates a MultiMap and adds few elements into it. Multimap<Integer, String> multimap = HashMultimap.create(); multimap.put(5,"example"); multimap.put(1,"is"); multimap.put(1,"this"); multimap.put(4,"so...

How to remove a specific pair from a C++ multimap?

#include <map> ... multimap<char,int> first; first.insert(pair<char,int>('a',10)); first.insert(pair<char,int>('b',15)); first.insert(pair<char,int>('b',20)); first.insert(pair<char,int>('c',25)); Say I now want to remove one of the pairs I have just added to the map. I have examples to remove an entire key entry, which for key 'b'...

Problem in accessing elements from google HashMultimap

I am using below code to get & process value from google HashMultimap HashMultimap hmm = new HashMultimap(); HashMultimap hmm2 = new HashMultimap(); Element ele; : hmm2.put("name","Amit"); hmm.put("Amit",ele); hmm.put("rohit",hmm2); : Iterator itr = hmm.keys().iterator(); String ky = (String) itr.nex...