SortedMap.transformValues?

Brian Goetz brian.goetz at oracle.com
Fri Feb 8 09:27:10 PST 2013


Er, the second example should be "keys()" not "entrySet()".  Sorry.

On 2/8/2013 11:58 AM, Brian Goetz wrote:
> // Imperative way:
> Map<K,V1> oldMap = ...
> Map<K,V2> newMap
>     = oldMap.entrySet().stream()
>             .forEach(e -> newMap.put(e.getKey(), f.apply(e.getvalue()));
>
> // Collector way (works in parallel!)
> Map<K,V2> newMap
>     = oldMap.entrySet().stream()
>             .collect(joiningWith(k -> f.apply(oldMap.get(k)));
>
>
> On 2/8/2013 11:42 AM, Michael Nascimento wrote:
>> Any chance of getting an updated version for b76?
>>
>> On Wed, Jan 16, 2013 at 3:57 PM, Michael Nascimento <misterm at gmail.com> wrote:
>>> Hi guys,
>>>
>>> What is the lambda way of achieving:
>>>
>>> http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/collect/Maps.html#transformValues(java.util.SortedMap,
>>> com.google.common.base.Function)
>>>
>>> ?
>>>
>>> Regards,
>>> Michael
>>
>


More information about the lambda-dev mailing list