Open markusheiden opened 1 year ago
Map#fastForEach
Sorry for bugging you again, but there is just a FastEntrySet#fastForEach(Consumer
I opened this issue because I am missing the "syntactic sugar variant" using a BiConsumer. That allows for way better readable code like map.forEach((key, value) -> ...)
instead of using the "clumsy" Entry#getKey and Entry#get*Value with the method mentioned above.
So it would be nice if you would reopen this issue.
I now see your point. The problem is that we do not have type-specific BiConsumers. Are there some provided by the JDK?
if I recall correctly, there are none indeed! It would certainly be nice to have it, not only from code style but also performance (EntrySet#forEach
allocates objects)
It looks like this also came up when Java 8 support was discussed: https://github.com/vigna/fastutil/issues/64#issuecomment-303649328
I would like to iterate a map's entry set without the need for boxing. I found no equivalent for Map#forEach though.
One could achieve this via iterating over
*2*EntrySet()
but the code looks less readable then.