IMO, the streams designers made one ergonomic mistake - the one-argument toMap() method takes a valuemapper instead of a keymapper. I guess they flipped a coin? In my entire life I have never used the one-argument valuemapper, but I write this all the time:
toMap(Thing::getKey, Function.identity())
It would be more ergonomic to simply write:
toMapKey(Thing::getKey)
(or any other method name; it doesn't have to be toMapKey)
It would be lovely if StreamEx added this little convenience method. Thanks!
A minor feature request:
IMO, the streams designers made one ergonomic mistake - the one-argument
toMap()
method takes a valuemapper instead of a keymapper. I guess they flipped a coin? In my entire life I have never used the one-argument valuemapper, but I write this all the time:toMap(Thing::getKey, Function.identity())
It would be more ergonomic to simply write:
toMapKey(Thing::getKey)
(or any other method name; it doesn't have to be
toMapKey
)It would be lovely if StreamEx added this little convenience method. Thanks!