Description
This issue was originally filed by @seaneagan
The following methods transform one Collection into another:
Map#getKeys
Map#getValues
Collection#filter
Collection#map (see issue #945)
At least some of these currently return an eager "snapshots" of the transformation.
They should instead return lazy "views" backed by the original Collection. Here's why:
* Avoids copying internal values (which is O(n))
* Can chain together multiple transformations without creating intermediate throw away Collections.
* Avoid having to call the method every single time updated values from the original Collection are needed (the majority use case).
* Copy constructors are already a much more orthogonal way to snapshot Collections, on the rare occasion that that is needed. For example:
// see issue #1248
new Set.from(map.keys)
new List.from(map.values)
// see issue #1304
new Collection.from(collection.filter(callback))
new Collection.from(collection.map(callback))