public int size() { return this.parent.size(); } public boolean isEmpty() {
public int size() { return this.parent.size(); }
public int size() { return this.parent.size(); }
public int size() { return this.parent.size(); } public boolean isEmpty() {
public int size() { return this.parent.size(); }
public int size() { return this.parent.size(); }
/** * Gets the first key in this map by insert order. * * @return the first key currently in this map * @throws NoSuchElementException if this map is empty */ public Object firstKey() { if (size() == 0) { throw new NoSuchElementException("Map is empty"); } return insertOrder.get(0); }
/** * Gets the first key in this map by insert order. * * @return the first key currently in this map * @throws NoSuchElementException if this map is empty */ public Object firstKey() { if (size() == 0) { throw new NoSuchElementException("Map is empty"); } return insertOrder.get(0); }
/** * Gets the next key to the one specified using insert order. * This method performs a list search to find the key and is O(n). * * @param key the key to find previous for * @return the next key, null if no match or at start */ public Object nextKey(Object key) { int index = insertOrder.indexOf(key); if (index >= 0 && index < size() - 1) { return insertOrder.get(index + 1); } return null; }
/** * Gets the next key to the one specified using insert order. * This method performs a list search to find the key and is O(n). * * @param key the key to find previous for * @return the next key, null if no match or at start */ public Object nextKey(Object key) { int index = insertOrder.indexOf(key); if (index >= 0 && index < size() - 1) { return insertOrder.get(index + 1); } return null; }
public void testValueList_getByIndex() { resetFull(); ListOrderedMap lom = (ListOrderedMap) map; for (int i = 0; i < lom.size(); i++) { Object expected = lom.getValue(i); assertEquals(expected, lom.valueList().get(i)); } }
public void testValueList_removeByIndex() { resetFull(); ListOrderedMap lom = (ListOrderedMap) map; while (lom.size() > 1) { Object expected = lom.getValue(1); assertEquals(expected, lom.valueList().remove(1)); } }
public void testValueList_setByIndex() { resetFull(); ListOrderedMap lom = (ListOrderedMap) map; for (int i = 0; i < lom.size(); i++) { Object input = new Integer(i); Object expected = lom.getValue(i); assertEquals(expected, lom.valueList().set(i, input)); assertEquals(input, lom.getValue(i)); assertEquals(input, lom.valueList().get(i)); } }
public void testSetValueByIndex() { resetEmpty(); ListOrderedMap lom = (ListOrderedMap) map; try { lom.setValue(0, ""); } catch (IndexOutOfBoundsException ex) {} try { lom.setValue(-1, ""); } catch (IndexOutOfBoundsException ex) {} resetFull(); lom = (ListOrderedMap) map; try { lom.setValue(-1, ""); } catch (IndexOutOfBoundsException ex) {} try { lom.setValue(lom.size(), ""); } catch (IndexOutOfBoundsException ex) {} for (int i = 0; i < lom.size(); i++) { Object value = lom.getValue(i); Object input = new Integer(i); assertEquals(value, lom.setValue(i, input)); assertEquals(input, lom.getValue(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)); } }
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 testGetValueByIndex() { resetEmpty(); ListOrderedMap lom = (ListOrderedMap) map; try { lom.getValue(0); } catch (IndexOutOfBoundsException ex) {} try { lom.getValue(-1); } catch (IndexOutOfBoundsException ex) {} resetFull(); lom = (ListOrderedMap) map; try { lom.getValue(-1); } catch (IndexOutOfBoundsException ex) {} try { lom.getValue(lom.size()); } catch (IndexOutOfBoundsException ex) {} int i = 0; for (MapIterator it = lom.mapIterator(); it.hasNext(); i++) { it.next(); assertSame(it.getValue(), lom.getValue(i)); } }
public void testGetValueByIndex() { resetEmpty(); ListOrderedMap lom = (ListOrderedMap) map; try { lom.getValue(0); } catch (IndexOutOfBoundsException ex) {} try { lom.getValue(-1); } catch (IndexOutOfBoundsException ex) {} resetFull(); lom = (ListOrderedMap) map; try { lom.getValue(-1); } catch (IndexOutOfBoundsException ex) {} try { lom.getValue(lom.size()); } catch (IndexOutOfBoundsException ex) {} int i = 0; for (MapIterator it = lom.mapIterator(); it.hasNext(); i++) { it.next(); assertSame(it.getValue(), lom.getValue(i)); } }