blob: cd2ae910746af1b176a6ca17719eb6bf5148addf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package pl.edu.mimuw.cloudatlas.model;
import java.util.Iterator;
import java.util.Map.Entry;
public class AttributesUtil {
public static void transferAttributes(AttributesMap fromAttributes, AttributesMap toAttributes) {
Iterator<Entry<Attribute, Value>> iterator = toAttributes.iterator();
while (iterator.hasNext()) {
Entry<Attribute, Value> entry = iterator.next();
Attribute attribute = entry.getKey();
Value newValue = fromAttributes.getOrNull(attribute);
if (newValue == null) {
iterator.remove();
}
}
for (Entry<Attribute, Value> entry : fromAttributes) {
toAttributes.addOrChange(entry.getKey(), entry.getValue());
}
}
}
|