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