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