1 | Iterator iter = coll.entrySet().iterator();↵ | | 1 | Iterator iter = coll.iterator();↵
|
2 | Map newColl = null;↵ | | 2 | Collection newColl = null;↵
|
3 | while (iter.hasNext()) {↵ | | 3 | while (iter.hasNext()) {↵
|
4 | Map.Entry entry = (Map.Entry) iter.next();↵ | | 4 | ↵
|
5 | Object item = entry.getKey();↵ | | |
|
6 | Object prop = entry.getValue();↵ | | 5 | Object item = iter.next();↵
|
7 | if (newColl == null) {↵ | | 6 | if (newColl == null) {↵
|
8 | try {↵ | | 7 | try {↵
|
9 | newColl = (Map) coll.getClass().newInstance();↵ | | 8 | newColl = (Collection) coll.getClass().newInstance();↵
|
10 | } catch (Exception e) {↵ | | 9 | } catch (Exception e) {↵
|
11 | log.error("Bad collection", e);↵ | | 10 | log.error("Bad collection", e);↵
|
12 | return coll;↵ | | 11 | return coll;↵
|
13 | }↵ | | 12 | }↵
|
14 | }↵ | | 13 | }↵
|
15 | newColl.put(item, convertObject(prop));↵ | | 14 | newColl.add(convertObject(item));↵
|
16 | }↵ | | 15 | }↵
|
17 | if (newColl != null) {↵ | | 16 | if (newColl != null) {↵
|
18 | return newColl;↵ | | 17 | return newColl;↵
|
19 | } else {↵ | | 18 | } else {↵
|
20 | return coll;↵ | | 19 | return coll;↵
|
21 | } | | 20 | }
|