Vavr: Should MultiMap.asMap() exist?

Created on 24 Oct 2018  路  3Comments  路  Source: vavr-io/vavr

I'm struck that Multimap.toJavaMap() exists, but Multimap.toMap() does not.

multimap.keySet().toMap(Function.identity(), key -> multimap.getOrElse(key, Set())) is a bit much.

Should there be a new method here to make it simpler (similar to #1274)?

feature revertecloseduplicate

Most helpful comment

I wanted to help, but I might be missing something: Multimap already has a method called asMap(), which appears to do what I'd expect. I found only one test, which turns Multimap { 1 => 2, 1 => 3 } into Map { 1 => [2, 3] }. This at least suggests exactly the same thing as @skestle seems to expect.

Were you look for something else, @skestle?

All 3 comments

Hi @skestle,
sorry for the late answer.
We can add it to master (v0.9.x).v1.0 is still in the design stage.

I wanted to help, but I might be missing something: Multimap already has a method called asMap(), which appears to do what I'd expect. I found only one test, which turns Multimap { 1 => 2, 1 => 3 } into Map { 1 => [2, 3] }. This at least suggests exactly the same thing as @skestle seems to expect.

Were you look for something else, @skestle?

Multimap will probably not part of Vavr 1. We want to focus on the most frequently used collections. Maybe we will release some kind of add-on collections package later.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jniedzwiecki picture jniedzwiecki  路  6Comments

rumatoest picture rumatoest  路  5Comments

Pyeroh picture Pyeroh  路  3Comments

nfekete picture nfekete  路  5Comments

carnott-snap picture carnott-snap  路  4Comments