Is there a multimap in Kotlin?

I need to save the values ​​in map likie this:

val map = HashMap<String, Set<String>>() 

But it's hard to interact with Set inside the map.

Does Kotlin have multiprocessor implementations like Multimap in Google Guava ?

+5
source share
1 answer

No, currently not. And, probably, in the future they will not be.

Link: https://discuss.kotlinlang.org/t/the-standard-library-and-a-kotlin-manifesto/1303/6

Alternative:

 org.springframework.util.MultiValueMap org.apache.commons.collections4.MultiMap com.google.common.collect.Multimap 

To play using Set in your example, you can:

 map["key"].forEach(::println) 

Or something else.

+6
source

Source: https://habr.com/ru/post/1274119/


All Articles