Questions tagged [nested-map]

63 questions
1
vote
2 answers

How to convert map and nested map to string and vise versa in Kotlin?

I have no idea how to convert HashMap and nested Hashmap to string and vise versa: I use Room to save data in a local database. The "users " hashmap is a parameter of the data class. To save this parameter "users " in the Room database, we must…
Zheentoro
  • 37
  • 9
1
vote
2 answers

C++Map :Accessing map inside a map

How can I loop, access and assign through a std::map in C++? My map is defined as: std::map> For example, the above container holds data like this: m["country"]["capital"] = value; m["country1"]["capital1"] =…
ann
  • 11
  • 3
1
vote
1 answer

Initialize a multilayer nested map that's inside a struct GO

I'm new to golang and kinda new to coding in general and I've been stuck on this problem. I've found multiple examples on how to do this with two layers of map but none of them scale well to three layers. I have some code that looks something like…
Emma
  • 11
  • 1
1
vote
1 answer

How to render a nested map as JSON from the Controller

This solution does not work for a nested map. I'm trying to convert to JSON. I need to send this nested map because it contains a lot that I need for a graph which I'm going to make with plotly on the frontend. This is what the nestedMap looks like…
AlleyCat
  • 11
  • 2
1
vote
2 answers

Java map of map (nested map) sorting

I have a nested map as Map> map = new TreeMap>(); Also, I have deep map as HashMap deep_map = new HashMap(); I read lines from txt file and put in…
I.Bozcan
  • 45
  • 1
  • 7
1
vote
0 answers

nested map in d3 (custom key)

I am trying to create a nested map, something like this, Map>>> using d3 map. I don't want to use d3.nest as I want to index my data on custom keys for faster pruning. My key is getting created as per my…
Rockstar
  • 33
  • 4
1
vote
2 answers

Clojure destruct map to parse as key parameters

I have a question regarding two functions, one taking a complete map and the other specific keywords like so: (def mapVal {:test "n" :anotherKey "n"}) (defn functionTest [& {:keys [test anotherKey] :or {:test "d" :anotherKey "d"}}] (println…
1
vote
1 answer

C++ passing a nested unordered_map by reference and manipulating it

I have 2 classes (firstClass and secondClass) of which firstClass is a friend of secondClass, and has a private nested std::unordered_map, which I want to access it in a function of secondClass. So basically the code is like this: class…
Hakim
  • 11,110
  • 14
  • 34
  • 37
1
vote
2 answers

Is there any way to predefine std::set size in c++?

I have a nested map containing a std::set<> STL, Is there any way to predefine the max size of set in c++? Following is my DS: std::map > > Can I define max size of std::set without defining the size of…
BSalunke
  • 11,499
  • 8
  • 34
  • 68
1
vote
1 answer

How to share the key across the different map in c++?

I'm working on map, I stored the data into two different map(it is nested map) having same key, Is their any way to store this data into single DS rather that two different nested maps. Following are my two nested maps: std::map
BSalunke
  • 11,499
  • 8
  • 34
  • 68
1
vote
2 answers

Flatten Nested Map into List with Depth-First Search Ordering

In clojure, how can I turn a nested map like this: {"1" {"1.1" {"1.1.1" {} "1.1.2" {}} "1.2" {}} "2" {"2.1" {} "2.2" {} "2.3" {}}} Into this: ("1" "1.1" "1.1.1" "1.1.2" "1.2" "2" "2.1" "2.2" "2.3")
user3594595
0
votes
0 answers

C++ cannot convert initializer list to map

I am declaring a map in a header file, which maps 2 strings to a function pointer in another cpp file. However, I'm getting the following error: Error C2440 'initializing': cannot convert from 'initializer list' to…
float
  • 15
  • 1
  • 6
0
votes
1 answer

Iterate nested map recursively in groovy jenkins

While iterating map I am getting error. Followed with the below approach: How to iterate through all values of a nested map in groovy def deNull(root) { if (root instanceof List) { root.collect { if (it instanceof Map) { deNull(it) } else if (it…
Amit
  • 15
  • 3
0
votes
1 answer

Clojure update nested map inside atom

I have an atom like this, inside a let: (let [scors (atom {:one {:year-one [] :year-five [] :year-ten []} :two {:year-one [] :year-five [] :year-ten []} :three {:year-one [] :year-five [] :year-ten []})] …
niloofar
  • 2,244
  • 5
  • 23
  • 44
0
votes
1 answer

Java - How to create a new map containing summed fields from a map containing a key and list of fields

I am provided with a List The Result class has a number of fields of which five are of interest class Result { public enum SESSION_TYPE { NIGHT, DAY } private SESSION_TYPE sessionType; private String…