Paul Sandoz paul.sandoz at
Thu Jan 17 01:57:37 PST 2013

On Jan 16, 2013, at 6:57 PM, Michael Nascimento <misterm at> wrote:

> Hi guys,
> What is the lambda way of achieving:
> ?

There is no exact equivalence because the Guava Maps.transformValues creates a view over the original map, it is lazy. 

Lazy map views in the JDK would i think require some closer integration with the existing map implementations rather than using the lambda Stream APIs.

FWIW using the Collectors a copy would have to be made:

SortedMap map = ...
SortedMap copy = map.entrySet().collect(
    e -> e.getKey(),
    e -> e.getValue(),

Quite a mouthful!

If/when we re-introduce MapStream we could do:;

But still that is not lazy.


More information about the lambda-dev mailing list