1 package fr.in2p3.jsaga.helpers.cloner;
2
3 import fr.in2p3.jsaga.impl.attributes.Attribute;
4
5 import java.util.*;
6
7
8
9
10
11
12
13
14
15
16
17
18
19 public class AttributeCloner<K> {
20 public Map<K,Attribute> cloneMap(Map<K,Attribute> map) throws CloneNotSupportedException {
21 Map<K,Attribute> mapClone = new HashMap<K,Attribute>();
22 for (Map.Entry<K,Attribute> entry : map.entrySet()) {
23 K key = entry.getKey();
24 Attribute value = entry.getValue();
25 Attribute valueClone = value.clone();
26 mapClone.put(key, valueClone);
27 }
28 return mapClone;
29 }
30
31 public List<Attribute> cloneList(List<Attribute> list) throws CloneNotSupportedException {
32 List<Attribute> listClone = new ArrayList<Attribute>();
33 for (Attribute value : list) {
34 Attribute valueClone = value.clone();
35 listClone.add(valueClone);
36 }
37 return listClone;
38 }
39 }