Skip to content
Advertisement

why MultiMap.add() is producing like {Test_Case: [[1.0, 2.0, 3.0]]} but it should be {Test_Case: [1.0, 2.0, 3.0]}

This is the piece of code where key is of type String and value is List, but when i collecting all list elements and adding same to MultiMap object its adding as [[]], The intension of using MultiMap is due to im having same key with different values (here “$.name” is having multiple values)

JavaScript

this is the output im getting

JavaScript

but it shouldn’t be inside array of array[[]]

please let me know what im missing.

Advertisement

Answer

I think you need something like the following ( untested ) code. I’ve never used MultiMap, but it looks like you just add items to it like it was a normal map, and it takes care of adding them to a collection mapped to the key.

JavaScript

That’s what this link seems to indicate anyway.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement