Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I run into the equivalent problem in Kotlin sometimes. I want to group things by a key, but that results in type `Map<K, List<V>>` because the compiler can't be sure that there won't be more than one `V` for the field being used for grouping... which is why there's also `associateBy` which does return `Map<K, V>`, but will throw if there happens to be more than one value for each K.

Not relevant, but I thought it may help other readers understand the problem.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: