/** * Tests whether this map contains the given key or value. * * @param value the value. * @return true if the key or value is contained in the map */ public boolean contains(final Object value) { if (containsKey(value)) { return true; } return containsValue(value); }
/** * Retrieves the first value registered for an key or null if there was no * such key in the list. * * @param key the key. * @return the value. */ public Object getFirst(final Object key) { return get(key, 0); }
final HashNMap classMap = new HashNMap(); for (int i = 0; i < baseClasses.length; i++) { classMap.add(base, child); final Iterator keys = classMap.keys(); while (keys.hasNext()) { final Class base = (Class) keys.next(); final Class[] childs = (Class[]) classMap.toArray(base, new Class[0]); if (childs.length < 2) { continue;
/** * Creates a deep copy of this HashNMap. * * @return a clone. * @throws CloneNotSupportedException this should never happen. */ public Object clone() throws CloneNotSupportedException { final HashNMap map = (HashNMap) super.clone(); map.table = new HashMap(); final Iterator iterator = keys(); while (iterator.hasNext()) { final Object key = iterator.next(); final List list = (List) map.table.get(key); if (list != null) { map.table.put(key, ObjectUtilities.clone(list)); } } return map; }
/** * Adds a new key/value pair into this map. If the key is not yet in the * map, it gets added to the map and the call is equal to * put(Object,Object). * * @param key the key. * @param val the value. * @return true, if the value has been added, false otherwise */ public boolean add(final Object key, final Object val) { final List v = (List) this.table.get(key); if (v == null) { put(key, val); return true; } else { return v.add(val); } }
/** * Inserts a new key/value pair into the map. If such a pair already * exists, it gets replaced with the given values. * * @param key the key. * @param val the value. * @return A boolean. */ public boolean put(final Object key, final Object val) { final List v = (List) this.table.get(key); if (v == null) { final List newList = createList(); newList.add(val); this.table.put(key, newList); return true; } else { v.clear(); return v.add(val); } }
this.classDescriptionByPackage = new HashNMap(); for (int i = 0; i < model.size(); i++) { final ClassDescription cd = model.get(i); final String includeFileName = this.plainFileName + "-" + packageName + this.extension; this.classDescriptionByPackage.add(includeFileName, cd); this.classDescriptionByPackage.add(cd.getSource(), cd); this.manualMappingByPackage = new HashNMap(); for (int i = 0; i < manualMappings.length; i++) { final ManualMappingInfo mapping = manualMappings[i]; if (mapping.getSource() == null) { this.manualMappingByPackage.add("", mapping); this.manualMappingByPackage.add(mapping.getSource(), mapping); this.multiplexMappingByPackage = new HashNMap(); for (int i = 0; i < multiplexMappings.length; i++) { final MultiplexMappingInfo mapping = multiplexMappings[i]; if (mapping.getSource() == null) { this.multiplexMappingByPackage.add("", mapping); this.multiplexMappingByPackage.add(mapping.getSource(), mapping); final Object[] keys = this.classDescriptionByPackage.keySet().toArray(); for (int i = 0; i < keys.length; i++) {
final Object[] keys = this.classDescriptionByPackage.keySet().toArray(); Arrays.sort(keys); for (int i = 0; i < keys.length; i++) { final Iterator values = this.classDescriptionByPackage.getAll(""); while (values.hasNext()) { final ClassDescription cd = (ClassDescription) values.next(); final Iterator manualMappings = this.manualMappingByPackage.getAll(""); while (manualMappings.hasNext()) { final ManualMappingInfo mi = (ManualMappingInfo) manualMappings.next(); final Iterator multiplexMappings = this.multiplexMappingByPackage.getAll(""); while (multiplexMappings.hasNext()) { final MultiplexMappingInfo mi = (MultiplexMappingInfo) multiplexMappings.next();
final Iterator values = this.classDescriptionByPackage.getAll(includeFileName); final Iterator manualMappings = this.manualMappingByPackage.getAll(includeFileName); final Iterator multiplexMappings = this.multiplexMappingByPackage.getAll(includeFileName); if (!values.hasNext() && !manualMappings.hasNext() && !multiplexMappings.hasNext()) { return;
/** * Creates a deep copy of this HashNMap. * * @return a clone. * @throws CloneNotSupportedException this should never happen. */ public Object clone() throws CloneNotSupportedException { final HashNMap map = (HashNMap) super.clone(); map.table = new HashMap(); final Iterator iterator = keys(); while (iterator.hasNext()) { final Object key = iterator.next(); final List list = (List) map.table.get(key); if (list != null) { map.table.put(key, ObjectUtilities.clone(list)); } } return map; }
/** * Adds a new key/value pair into this map. If the key is not yet in the * map, it gets added to the map and the call is equal to * put(Object,Object). * * @param key the key. * @param val the value. * @return true, if the value has been added, false otherwise */ public boolean add(final Object key, final Object val) { final List v = (List) this.table.get(key); if (v == null) { put(key, val); return true; } else { return v.add(val); } }
/** * Inserts a new key/value pair into the map. If such a pair already * exists, it gets replaced with the given values. * * @param key the key. * @param val the value. * @return A boolean. */ public boolean put(final Object key, final Object val) { final List v = (List) this.table.get(key); if (v == null) { final List newList = createList(); newList.add(val); this.table.put(key, newList); return true; } else { v.clear(); return v.add(val); } }
/** * Tests whether this map contains the given key or value. * * @param value the value. * @return true if the key or value is contained in the map */ public boolean contains(final Object value) { if (containsKey(value)) { return true; } return containsValue(value); }
/** * Retrieves the first value registered for an key or null if there was no * such key in the list. * * @param key the key. * @return the value. */ public Object getFirst(final Object key) { return get(key, 0); }
/** * Creates a deep copy of this HashNMap. * * @return a clone. * @throws CloneNotSupportedException this should never happen. */ public Object clone() throws CloneNotSupportedException { final HashNMap map = (HashNMap) super.clone(); map.table = new HashMap(); final Iterator iterator = keys(); while (iterator.hasNext()) { final Object key = iterator.next(); final List list = (List) map.table.get(key); if (list != null) { map.table.put(key, ObjectUtilities.clone(list)); } } return map; }
/** * Adds a new key/value pair into this map. If the key is not yet in the * map, it gets added to the map and the call is equal to * put(Object,Object). * * @param key the key. * @param val the value. * @return true, if the value has been added, false otherwise */ public boolean add(final Object key, final Object val) { final List v = (List) this.table.get(key); if (v == null) { put(key, val); return true; } else { return v.add(val); } }
/** * Inserts a new key/value pair into the map. If such a pair already * exists, it gets replaced with the given values. * * @param key the key. * @param val the value. * @return A boolean. */ public boolean put(final Object key, final Object val) { final List v = (List) this.table.get(key); if (v == null) { final List newList = createList(); newList.add(val); this.table.put(key, newList); return true; } else { v.clear(); return v.add(val); } }
/** * Tests whether this map contains the given key or value. * * @param value the value. * @return true if the key or value is contained in the map */ public boolean contains(final Object value) { if (containsKey(value)) { return true; } return containsValue(value); }
/** * Retrieves the first value registered for an key or null if there was no * such key in the list. * * @param key the key. * @return the value. */ public Object getFirst(final Object key) { return get(key, 0); }