4 ms·
But those are streams on sets.
by tokenizerrr 11y ago
But those are streams on sets.
- mhaymo 11y agoThose are streams on views on the map. My complaint is that a reader seeing "maps don't support streams" with no further explanation is unlikely to get the correct idea, and may infer that something like map.entrySet().stream().filter(e -> e.getKey().equals(e.getValue())).findAny() is not expressible.
- masklinn 11y agoThey're streams on map views, a stream on Map itself doesn't really make sense because there are multiple ways to interpret a map as a sequence and it's not clear what should be the default (e.g. Python defaults to the equivalent of keySet().stream(), but Rust defaults to entrySet().stream()). keySet() and entrySet() return Set-conforming objects because they can, values() can't and only returns a Collection, but these three objects delegate much of their logic to the map itself.