/** * Gets the last (and only) key in the map. * * @return the key */ public Object lastKey() { return getKey(); }
/** * Gets the first (and only) key in the map. * * @return the key */ public Object firstKey() { return getKey(); }
/** * Gets the first (and only) key in the map. * * @return the key */ public Object firstKey() { return getKey(); }
/** * Gets the last (and only) key in the map. * * @return the key */ public Object lastKey() { return getKey(); }
public Object next() { if (hasNext == false) { throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY); } hasNext = false; canGetSet = true; return parent.getKey(); }
public Object previous() { if (hasNext == true) { throw new NoSuchElementException(AbstractHashedMap.NO_PREVIOUS_ENTRY); } hasNext = true; return parent.getKey(); }
public Object getKey() { if (canGetSet == false) { throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID); } return parent.getKey(); }
public Object next() { if (hasNext == false) { throw new NoSuchElementException(AbstractHashedMap.NO_NEXT_ENTRY); } hasNext = false; canGetSet = true; return parent.getKey(); }
public Object getKey() { if (canGetSet == false) { throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID); } return parent.getKey(); }
public Object previous() { if (hasNext == true) { throw new NoSuchElementException(AbstractHashedMap.NO_PREVIOUS_ENTRY); } hasNext = true; return parent.getKey(); }
/** * Gets the entrySet view of the map. * Changes made via <code>setValue</code> affect this map. * To simply iterate through the entries, use {@link #mapIterator()}. * * @return the entrySet view */ public Set entrySet() { Map.Entry entry = new TiedMapEntry(this, getKey()); return Collections.singleton(entry); }
/** * Gets the entrySet view of the map. * Changes made via <code>setValue</code> affect this map. * To simply iterate through the entries, use {@link #mapIterator()}. * * @return the entrySet view */ public Set entrySet() { Map.Entry entry = new TiedMapEntry(this, getKey()); return Collections.singleton(entry); }
public void testKeyValue() { SingletonMap map = new SingletonMap(ONE, TWO); assertEquals(1, map.size()); assertEquals(ONE, map.getKey()); assertEquals(TWO, map.getValue()); assertTrue(map instanceof KeyValue); }
public Object getKey() { if (canGetSet == false) { throw new IllegalStateException(AbstractHashedMap.GETKEY_INVALID); } return parent.getKey(); }