I have a Map and I want to convert it to Map. The keys from the first Map will be equal to the ones in the second. MyObject has a property that I want to use as the value for the second map. So what I have now is a for loop that does:
for (Map.Entry<String, MyObject> entry : originalMap.getTextMessages().entrySet()) {
newMap.put(entry.getKey(), entry.getValue().getStringValue());
}
Now I've got the feeling it could be easier... can anyone shed a light on this? We're using Java 7 by the way but if you have some clever Java 8 function for this, please share it too.