Questions tagged [bimap]

Bidirectional map is associative data structure where keys and values can switch their roles.

Bidirectional maps on wikipedia

85 questions
0
votes
1 answer

Expose public view of privately scoped Boost.BiMap iterator

I have a privately scoped Boost.BiMap in a class, and I would like to export a public view of part of this map. I have two questions about the following code: class Object { typedef bimap< unordered_set_of, …
Noah Watkins
  • 5,446
  • 3
  • 34
  • 47
0
votes
0 answers

Android Studio ImageView and Bitmap

An activity has an icon to choose Image from Files. After choosing the Image, The next activity page opens which has A button and an ImageView where the selected iimage should be displayed. I can choose the Image but it does not show on…
0
votes
1 answer

How extend a BiMap with a Vec in Rust?

How can i push this ["a", "bb", "c", "dd", "e", "ff", "g", "hh"] //type is Vec to this fn list_codes() -> BiMap { let letters = BiMap::::new(); [('a',"cl01"), ('b',"cl02"), ('c',"cl03"), …
0
votes
2 answers

Java Initialize EnumBiMap From Two Enum Types

What's the most convenient way to initialize an EnumBiMap from two different enum types? I have the following scenario: public enum First { A, B, C } and public enum Second { ALPHA, BETA, GAMMA } I have tried something like …
Nizbel99
  • 123
  • 6
0
votes
1 answer

override getOrDefault of HashBiMap implementation

Working with Guava library. I want to override(to add some validation) the getOrDefault method of HashBiMap implementation. Looking into it, HashBiMap class is declared as final, I can't extend it. Any idea? @GwtCompatible(emulated = true) public…
Dc0
  • 11
  • 1
0
votes
1 answer

boost::bimap finds wrong entry when using a custom struct as the key, why?

i have a custom struct i am mapping to some data using a boost::bimap. Unfortunately, the bimap find() does not work as expected. Below is a minimal example to demonstrate: #include #include struct S{ int a; int…
kaneco
  • 3
  • 1
0
votes
1 answer

Is there a way to force every element of a (multiset_of,multiset_of) boost::bimap to be unique?

I have a multi set Bimap that looks like: 6 <--> 71 6 <--> 71 6 <--> 71 8 <--> 71 8 <--> 71 10 <--> 71 10 <--> 74 element = left key + right key, or a row in the above block I would like to remove the elements where the lines are equivalent to…
0
votes
2 answers

How can I compare a String with an Array of Strings to get the Value from a Map?

I'm having a BiMap with a String as key and an array of Strings as value. Now i'm trying to get with a single String (which is part of the value array) the key. private static BiMap map = ImmutableBiMap.
LucBBC
  • 29
  • 3
0
votes
1 answer

C++ boost::bimap insert() method not working

I am trying to insert data in boost::bimap but gives an error. typedef boost::bimap bimap_type; bimap_type _obs_ids; void store_domains_obs_ids(const std::string & name, const std::string & obs_id) const { …
0
votes
1 answer

Google Guava BiMap - inversed get-Method doesn't work

I really don't like asking here, but this time I've searched, I've read the docs, I've asked for help in other places and apparently nobody knows how to fix my problem. I use the BiMap from google Guava for my java application, because I have a…
Johnny
  • 67
  • 5
0
votes
1 answer

Is C++ bimap possible with one side of view having different key than other side of the view value? How to do that?

At the beginning I needed a map, so I used std::map. Then, some requirements were added and I needed to also get "keys" for "value" (foos for bar), so I used boost::bimaps::bimap< …
Lukas Salich
  • 959
  • 2
  • 12
  • 30
0
votes
1 answer

Boost BiMap Parse Template Error

I am getting parse template error when I add #include I want to find the key of a map from its value and hence thought of using Boost's Bimap but getting below error. /usr/include/boost/bimap/relation/structured_pair.hpp: In…
spnsp
  • 163
  • 1
  • 8
0
votes
0 answers

How to add values in BiMap JAVA 8?

I am trying to create a BiMap. BiMap> rankedItem = HashBiMap.create(); for (Catalogue catlogue : latestItemCataloug) { String name = catlogue.getName(); List itemList…
user3407267
  • 1,524
  • 9
  • 30
  • 57
0
votes
0 answers

Is there a functional n:1 bimap?

I have a map where multiple keys can map to the same value. I'd like to do reverse lookups, such that given a value, I get a list of all keys that map to this value. Note that unlike Data.Bimap my map is not 1:1 but n :1. Also, the reverse lookup…
Dierk
  • 1,308
  • 7
  • 13
0
votes
1 answer

Masked bitmap on canvas with transparent activity

I implemented custom ShowCase for activity I am trying to draw on canvas mask: https://i.stack.imgur.com/u23kQ.png Following this code: mCanvas.drawColor(Color.TRANSPARENT, PorterDuff.Mode.CLEAR); // draw solid background …
SSHEX
  • 27
  • 1
  • 9