cdurham
07/28/2017, 10:52 PMfilterTo
?diesieben07
07/28/2017, 10:53 PMaphex
07/28/2017, 11:01 PMfilterTo
requires a mutable map, of coursecdurham
07/28/2017, 11:01 PMHashMap
not mutable?aphex
07/28/2017, 11:02 PM.filterToType<HashMap<K,V>
or something….diesieben07
07/28/2017, 11:02 PMdiesieben07
07/28/2017, 11:02 PMdiesieben07
07/28/2017, 11:04 PMfilter
does, by the way, is call filterTo
with a LinkedHashMap
. So if you do val filtered: Map<K, V> = filterTo(HashMap()) { }
you have the same effect.cdurham
07/28/2017, 11:05 PMHashMap
using filterTo does that. if you really need you can cast it, although IMO you shouldn't need to know the concrete type in most scenariosdiesieben07
07/28/2017, 11:06 PMfilter
! That is not guaranteed to work and might crash with a newer version of Kotlin.cdurham
07/28/2017, 11:06 PMfilterTo
not filter
diesieben07
07/28/2017, 11:06 PMfilterTo
.diesieben07
07/28/2017, 11:07 PM