Questions tagged [nested-map]

63 questions
11
votes
1 answer

Terraform - iterate over nested map

I am trying to create IAM binding for Bigquery dataset using the resource - google_bigquery_dataset_iam_binding. The requirement is I read the parameters in this resource (dataset_id, role, members) using a variable of the following structure - …
mb_96
  • 127
  • 1
  • 2
  • 9
7
votes
1 answer

creating nested maps with nested properties from List, stream, Java 8

I made this question stream creating List of List (nested List) using forEach, Java 8 class EntityCompositeId { private Long firstId; private Long secondId; // getter & setter... } class EntityComposite { private EntityCompositeId…
joseluisbz
  • 1,491
  • 1
  • 36
  • 58
4
votes
1 answer

What is the easiest way to change the inner value type in a nested map in java?

I have a nested map Map>> passed to me, and I want to change it to type Map>>, what is the easiest way to do so in Java using stream? I have tried to use Collectors.groupingBy but…
3
votes
1 answer

Filter on a value of inner Map using Java 8 streams

I have a map of maps - Map> - collection. I need to filter the map and get the outer map that has a given value for a given key of the inner map. I tried some combinations, but it is not working. How do I achieve this. This is what I have…
adbdkb
  • 1,897
  • 6
  • 37
  • 66
3
votes
1 answer

how assign values to a nested map

I have a map nested inside another map, I want to assign values to the outer map, but i'm not quite sure how to do it. this causes the program to break even before it begins. I'm not showing any errors when I run it though map>…
conterio
  • 1,087
  • 2
  • 12
  • 25
2
votes
1 answer

groovy nested map update value without checking type of value

I have two maps , def configmap = [ "env" :["required": ["team" : "k", "test": "sample"], "optional" : ["anotherkey" : ""]]] def valuesReplacementMap=[ "env.required.team":"s","env.required.test":"new", "env.optional.anotherkey":"newvalue"…
mskm
  • 37
  • 9
2
votes
1 answer

Nested Hashmap: Alternative to putIfAbsent which does not requires null check and manual get?

I have a nested HashMap looking like this: HashMap>. I created a add method to fill the HashMap private void add(String currentVersion, String targetVersion, Object object) { HashMap
Herr Derb
  • 4,977
  • 5
  • 34
  • 62
2
votes
2 answers

C++ Map : manipulate map inside map

I'm more used to a single map and not to nested map. So I have serious difficulty understanding how to deal with this. Remark: Please don't request me to use multimap or boost,I'm restricted to use this structure In C++ STL map, i have a…
David Edgar
  • 477
  • 8
  • 23
2
votes
2 answers

Conversions Java Properties to Map to Nested Map to JSON

As an exercise and some in-house util i'm building, i'd like to convert a java properties file to json hierarchy foo.bar=15 foo.lots.dir=/tmp/test foo.baz.host=localhost foo.baz.port=333 I've managed to converted to a scala map, here's the code:…
dlite922
  • 1,924
  • 3
  • 24
  • 60
2
votes
1 answer

What are the similarities and differences between a lens in Haskell and using a key-sequence in Clojure?

Assumptions: I know that Haskell encourages solving problems with a type system, and Clojure eschews a type system, preferring to solve the problem with data structures. We can see that we can create a lens like this in Haskell: {-# LANGUAGE…
hawkeye
  • 34,745
  • 30
  • 150
  • 304
1
vote
2 answers

How to search(filter) in nested map and return entire map elements

I am trying to filter the map and in return, I want every filtered map element. Code:- Map> temp = {Basic Terms: {1: 0}, Table and Column Naming Rules: {1: 1}}; var temp = temp.keys.where(element) =>…
SPIDEY
  • 23
  • 3
1
vote
1 answer

Convert a List of JSON-objects input into a nested Map

I have a String input in the following format: Input String: [{ "id":"1", "name":"A", "address":"St 1"},{ "id":"2", "name":"B", "address":"St 2"}, ...] And I want to be able to convert this to a Map> format. So, something…
Batata
  • 98
  • 1
  • 11
1
vote
2 answers

Implement multi-dimensional std::map with std::tuple and view access

I know that I can create a multi-dimensional map by nesting maps together, e.g.: // Two-dimensional key map > m; so it is easy to extract all of the values associated to the highest order key. So if I have a set of data…
mcamurri
  • 153
  • 11
1
vote
1 answer

How to place a Map into another Map in Java

I'm doing a personal project. After a lot of maps, I came to the point where I want to enter a map inside another map... Let me explain better. I have this Map atPropostas which have information about a person, but at some time of the program, I…
1
vote
1 answer

clojure/clojurescript change just one key in nested map

I have this map: {:a {:a {:a 1 :b 2}}} And I want to turn it into this one: {:a {:a {:x 1 :b 2}}} I tried this, but -of course- got all :a replaced: (clojure.walk/postwalk-replace {:a :c} {:a {:a {:a 1 :b 2}}}) -> {:c {:c {:c 1, :b 2}}} I tried…
Luis López
  • 159
  • 8
1
2 3 4 5