public boolean hasNext() { return iterator.hasNext(); }
public boolean hasNext() { return iterator.hasNext(); }
public boolean hasNext() { return iterator.hasNext(); }
public boolean hasNext() { return iterator.hasNext(); }
/** * Write the map out using a custom routine. */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(size()); for (MapIterator it = mapIterator(); it.hasNext();) { out.writeObject(it.next()); // key out.writeObject(it.getValue()); // value } }
/** * Write the map out using a custom routine. */ private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); out.writeInt(size()); for (MapIterator it = mapIterator(); it.hasNext();) { out.writeObject(it.next()); // key out.writeObject(it.getValue()); // value } }
/** * Gets the hash code value for this map as per the API. * * @param type the KEY or VALUE int * @return the hash code value for this map */ private int doHashCode(final int type) { int total = 0; if (nodeCount > 0) { for (MapIterator it = new ViewMapIterator(this, type); it.hasNext(); ) { Object key = it.next(); Object value = it.getValue(); total += (key.hashCode() ^ value.hashCode()); } } return total; }
/** * Gets the hash code value for this map as per the API. * * @param type the KEY or VALUE int * @return the hash code value for this map */ private int doHashCode(final int type) { int total = 0; if (nodeCount > 0) { for (MapIterator it = new ViewMapIterator(this, type); it.hasNext(); ) { Object key = it.next(); Object value = it.getValue(); total += (key.hashCode() ^ value.hashCode()); } } return total; }
public void testIndexOf() { resetEmpty(); LinkedMap lm = (LinkedMap) map; assertEquals(-1, lm.indexOf(getOtherKeys())); resetFull(); lm = (LinkedMap) map; List list = new ArrayList(); for (MapIterator it = lm.mapIterator(); it.hasNext();) { list.add(it.next()); } for (int i = 0; i < list.size(); i++) { assertEquals(i, lm.indexOf(list.get(i))); } }
public void testIndexOf() { resetEmpty(); ListOrderedMap lom = (ListOrderedMap) map; assertEquals(-1, lom.indexOf(getOtherKeys())); resetFull(); lom = (ListOrderedMap) map; List list = new ArrayList(); for (MapIterator it = lom.mapIterator(); it.hasNext();) { list.add(it.next()); } for (int i = 0; i < list.size(); i++) { assertEquals(i, lom.indexOf(list.get(i))); } }
public void testIndexOf() { resetEmpty(); ListOrderedMap lom = (ListOrderedMap) map; assertEquals(-1, lom.indexOf(getOtherKeys())); resetFull(); lom = (ListOrderedMap) map; List list = new ArrayList(); for (MapIterator it = lom.mapIterator(); it.hasNext();) { list.add(it.next()); } for (int i = 0; i < list.size(); i++) { assertEquals(i, lom.indexOf(list.get(i))); } }
public void testMultiKeyRemoveAll4() { resetFull(); MultiKeyMap multimap = (MultiKeyMap) map; assertEquals(12, multimap.size()); multimap.removeAll(I1, I1, I2, I3); assertEquals(10, multimap.size()); for (MapIterator it = multimap.mapIterator(); it.hasNext();) { MultiKey key = (MultiKey) it.next(); assertEquals(false, I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2)) && key.size() >= 4 && I3.equals(key.getKey(3))); } }
public void testMultiKeyRemoveAll3() { resetFull(); MultiKeyMap multimap = (MultiKeyMap) map; assertEquals(12, multimap.size()); multimap.removeAll(I1, I1, I2); assertEquals(9, multimap.size()); for (MapIterator it = multimap.mapIterator(); it.hasNext();) { MultiKey key = (MultiKey) it.next(); assertEquals(false, I1.equals(key.getKey(0)) && I1.equals(key.getKey(1)) && I2.equals(key.getKey(2))); } }
public void testMultiKeyRemoveAll2() { resetFull(); MultiKeyMap multimap = (MultiKeyMap) map; assertEquals(12, multimap.size()); multimap.removeAll(I2, I3); assertEquals(9, multimap.size()); for (MapIterator it = multimap.mapIterator(); it.hasNext();) { MultiKey key = (MultiKey) it.next(); assertEquals(false, I2.equals(key.getKey(0)) && I3.equals(key.getKey(1))); } }
public void testMultiKeyRemoveAll1() { resetFull(); MultiKeyMap multimap = (MultiKeyMap) map; assertEquals(12, multimap.size()); multimap.removeAll(I1); assertEquals(8, multimap.size()); for (MapIterator it = multimap.mapIterator(); it.hasNext();) { MultiKey key = (MultiKey) it.next(); assertEquals(false, I1.equals(key.getKey(0))); } }
public void testMapIteratorRemoveGetKey() { if (supportsRemove() == false) { return; } MapIterator it = makeFullMapIterator(); Map map = getMap(); Map confirmed = getConfirmedMap(); assertEquals(true, it.hasNext()); Object key = it.next(); it.remove(); confirmed.remove(key); verify(); try { it.getKey(); fail(); } catch (IllegalStateException ex) {} verify(); }
public void testMapIteratorRemoveGetValue() { if (supportsRemove() == false) { return; } MapIterator it = makeFullMapIterator(); Map map = getMap(); Map confirmed = getConfirmedMap(); assertEquals(true, it.hasNext()); Object key = it.next(); it.remove(); confirmed.remove(key); verify(); try { it.getValue(); fail(); } catch (IllegalStateException ex) {} verify(); }
public void testMapIteratorSetRemoveSet() { if (supportsSetValue() == false || supportsRemove() == false) { return; } Object newValue = addSetValues()[0]; MapIterator it = makeFullMapIterator(); Map map = getMap(); Map confirmed = getConfirmedMap(); assertEquals(true, it.hasNext()); Object key = it.next(); it.setValue(newValue); it.remove(); confirmed.remove(key); verify(); try { it.setValue(newValue); fail(); } catch (IllegalStateException ex) {} verify(); }
public void testGetByIndex() { resetEmpty(); ListOrderedMap lom = (ListOrderedMap) map; try { lom.get(0); } catch (IndexOutOfBoundsException ex) {} try { lom.get(-1); } catch (IndexOutOfBoundsException ex) {} resetFull(); lom = (ListOrderedMap) map; try { lom.get(-1); } catch (IndexOutOfBoundsException ex) {} try { lom.get(lom.size()); } catch (IndexOutOfBoundsException ex) {} int i = 0; for (MapIterator it = lom.mapIterator(); it.hasNext(); i++) { assertSame(it.next(), lom.get(i)); } }
public void testGetByIndex() { resetEmpty(); ListOrderedMap lom = (ListOrderedMap) map; try { lom.get(0); } catch (IndexOutOfBoundsException ex) {} try { lom.get(-1); } catch (IndexOutOfBoundsException ex) {} resetFull(); lom = (ListOrderedMap) map; try { lom.get(-1); } catch (IndexOutOfBoundsException ex) {} try { lom.get(lom.size()); } catch (IndexOutOfBoundsException ex) {} int i = 0; for (MapIterator it = lom.mapIterator(); it.hasNext(); i++) { assertSame(it.next(), lom.get(i)); } }