Returns a view of a
ListMultimap where each value is transformed by
a function. All other properties of the multimap, such as iteration order,
are left intact. For example, the code:
ListMultimap multimap};
ListMultimap transformed = Multimaps.transformValues(map,
sqrt);
System.out.println(transformed);}
... prints
{a=[2.0, 4.0], b=[3.0]}}.
Changes in the underlying multimap are reflected in this view.
Conversely, this view supports removal operations, and these are reflected
in the underlying multimap.
It's acceptable for the underlying multimap to contain null keys, and
even null values provided that the function is capable of accepting null
input. The transformed multimap might contain null values, if the function
sometimes gives a null result.
The returned multimap is not thread-safe or serializable, even if the
underlying multimap is.
The function is applied lazily, invoked when needed. This is necessary
for the returned multimap to be a view, but it means that the function will
be applied many times for bulk operations like
Multimap#containsValue and
Multimap.toString(). For this to
perform well,
function should be fast. To avoid lazy evaluation
when the returned multimap doesn't need to be a view, copy the returned
multimap into a new multimap of your choosing.