1 24 25 package org.aspectj.util; 26 27 28 import java.util.*; 29 30 public class CollectionUtil { 31 public static List getListInMap(Map map, Object key) { 32 List list = (List)map.get(key); 33 if (list == null) { 34 list = new ArrayList(); 35 map.put(key, list); 36 } 37 return list; 38 } 39 40 public static SortedSet getSortedSetInMap(Map map, Object key) { 41 SortedSet list = (SortedSet)map.get(key); 42 if (list == null) { 43 list = new TreeSet(); 44 map.put(key, list); 45 } 46 return list; 47 } 48 49 public static Set getSetInMap(Map map, Object key) { 50 Set list = (Set)map.get(key); 51 if (list == null) { 52 list = new HashSet(); 53 map.put(key, list); 54 } 55 return list; 56 } 57 58 public static Map getMapInMap(Map map, Object key) { 59 Map list = (Map)map.get(key); 60 if (list == null) { 61 list = new HashMap(); 62 map.put(key, list); 63 } 64 return list; 65 } 66 } 67 | Popular Tags |