/** * Removes all mappings where the first key is that specified. * <p> * This method removes all the mappings where the <code>MultiKey</code> * has one or more keys, and the first matches that specified. * * @param key1 the first key * @return true if any elements were removed */ public boolean removeAll(final Object key1) { boolean modified = false; final MapIterator<MultiKey<? extends K>, V> it = mapIterator(); while (it.hasNext()) { final MultiKey<? extends K> multi = it.next(); if (multi.size() >= 1 && (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0)))) { it.remove(); modified = true; } } return modified; }
/** * Removes all mappings where the first two keys are those specified. * <p> * This method removes all the mappings where the <code>MultiKey</code> * has two or more keys, and the first two match those specified. * * @param key1 the first key * @param key2 the second key * @return true if any elements were removed */ public boolean removeAll(final Object key1, final Object key2) { boolean modified = false; final MapIterator<MultiKey<? extends K>, V> it = mapIterator(); while (it.hasNext()) { final MultiKey<? extends K> multi = it.next(); if (multi.size() >= 2 && (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) && (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1)))) { it.remove(); modified = true; } } return modified; }
/** * Removes all mappings where the first three keys are those specified. * <p> * This method removes all the mappings where the <code>MultiKey</code> * has three or more keys, and the first three match those specified. * * @param key1 the first key * @param key2 the second key * @param key3 the third key * @return true if any elements were removed */ public boolean removeAll(final Object key1, final Object key2, final Object key3) { boolean modified = false; final MapIterator<MultiKey<? extends K>, V> it = mapIterator(); while (it.hasNext()) { final MultiKey<? extends K> multi = it.next(); if (multi.size() >= 3 && (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) && (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) && (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2)))) { it.remove(); modified = true; } } return modified; }
/** * Removes all mappings where the first four keys are those specified. * <p> * This method removes all the mappings where the <code>MultiKey</code> * has four or more keys, and the first four match those specified. * * @param key1 the first key * @param key2 the second key * @param key3 the third key * @param key4 the fourth key * @return true if any elements were removed */ public boolean removeAll(final Object key1, final Object key2, final Object key3, final Object key4) { boolean modified = false; final MapIterator<MultiKey<? extends K>, V> it = mapIterator(); while (it.hasNext()) { final MultiKey<? extends K> multi = it.next(); if (multi.size() >= 4 && (key1 == null ? multi.getKey(0) == null : key1.equals(multi.getKey(0))) && (key2 == null ? multi.getKey(1) == null : key2.equals(multi.getKey(1))) && (key3 == null ? multi.getKey(2) == null : key3.equals(multi.getKey(2))) && (key4 == null ? multi.getKey(3) == null : key4.equals(multi.getKey(3)))) { it.remove(); modified = true; } } return modified; }
public Licence getLicence(Metier metier, Month month) { Licence result = null; for (MapIterator i=list.mapIterator(); i.hasNext();) { MultiKey keys = (MultiKey)i.next(); Metier metierKey = (Metier)keys.getKey(0); Month firstMonth = (Month)keys.getKey(1); Month lastMonth = (Month)keys.getKey(2); if (metier.equals(metierKey) && firstMonth.compareTo(month) <= 0 && month.compareTo(lastMonth) <= 0) { result = (Licence)i.getValue(); break; } } return result; }
MapIterator<MultiKey<? extends String>, List<Node>> mit = statEntries.mapIterator(); while (mit.hasNext()) { mit.next();