I have a map and I am iterating through it and modifying the values of the map using a for
loop. I wanted to know if there is a way I can do it using Java 8 streams.
Here's my code:
Map<String,MyObject> myMap = getResultMap();
for (Map.Entry<String, MyObject> entry : myMap.entrySet()) {
entry.getValue.setName(getName());
entry.getValue.setId(getId());
entry.getValue.setDept(getDept());
entry.getValue.isValid(isValid();
entry.getValue.setPipeLine(getPipeLine());
}
Basically, I wanted to stream the map values and set the values and get it as a new map.