@Test public void testRemoveValue() { KeyedObjects ko1 = new KeyedObjects(); ko1.setObject("Key 1", "Object 1"); ko1.setObject("Key 2", null); ko1.setObject("Key 3", "Object 2"); ko1.removeValue(1); assertEquals(2, ko1.getItemCount()); assertEquals(1, ko1.getIndex("Key 3")); ko1.removeValue("Key 1"); assertEquals(1, ko1.getItemCount()); assertEquals(0, ko1.getIndex("Key 3")); try { ko1.removeValue("UNKNOWN"); fail("Should have thrown UnknownKeyException on unknown key"); } catch (UnknownKeyException e) { assertEquals("The key (UNKNOWN) is not recognised.", e.getMessage()); } try { ko1.removeValue(null); fail("Should have thrown IllegalArgumentException on null key"); } catch (IllegalArgumentException e) { assertEquals("Null 'key' argument.", e.getMessage()); } }
public void removeValue(int index) { this.data.remove(index); }
KeyedObjects implements Cloneable, PublicCloneable, Serializable { public void removeValue(int index) { this.data.remove(index); } }
KeyedObjects implements Cloneable, PublicCloneable, Serializable { public void removeValue(int index) { this.data.remove(index); } KeyedObjects(); }
KeyedObjects implements Cloneable, PublicCloneable, Serializable { public void removeValue(int index) { this.data.remove(index); } KeyedObjects(); int getItemCount(); Object getObject(int item); Comparable getKey(int index); int getIndex(Comparable key); List<Comparable> getKeys(); Object getObject(Comparable key); void addObject(Comparable key, Object object); void setObject(Comparable key, Object object); void insertValue(int position, Comparable key, Object value); void removeValue(int index); void removeValue(Comparable key); void clear(); @Override Object clone(); @Override boolean equals(Object obj); @Override int hashCode(); }
KeyedObjects implements Cloneable, PublicCloneable, Serializable { public void removeValue(int index) { this.data.remove(index); } KeyedObjects(); int getItemCount(); Object getObject(int item); Comparable getKey(int index); int getIndex(Comparable key); List<Comparable> getKeys(); Object getObject(Comparable key); void addObject(Comparable key, Object object); void setObject(Comparable key, Object object); void insertValue(int position, Comparable key, Object value); void removeValue(int index); void removeValue(Comparable key); void clear(); @Override Object clone(); @Override boolean equals(Object obj); @Override int hashCode();  }