I have a map with strings, I want to transform it to a list of strings with \" \" as a key value separator. Is it possible using google collections?
Code example that I
public static void main(final String[] args)
{
final Map m = ImmutableMap.of("k1", "v1", "k2", "v2", "k3", "v3");
final Collection c = Maps.transformEntries(m, new Maps.EntryTransformer()
{
@Override public String transformEntry(@Nullable final String key, @Nullable final String value)
{
return Joiner.on(' ').join(key, value);
}
}).values();
System.out.println(c);
}
[k1 v1, k2 v2, k3 v3]