public override bool remove(Object value) { // do null comparison outside loop so we only need to do it once. This // provides a tighter, more efficient loop at the expense of slight // code duplication. if (value == null) { for (Entry pos = root.sentinel.next; pos != root.sentinel; pos = pos.next) { if (pos.getValue() == null) { root.removeImpl(pos.getKey()); return(true); } } } else { for (Entry pos = root.sentinel.next; pos != root.sentinel; pos = pos.next) { if (value.equals(pos.getValue())) { root.removeImpl(pos.getKey()); return(true); } } } return(false); }
public override bool remove(Object o) { Entry e = findEntry(o); if (e == null) { return(false); } return(root.removeImpl(e.getKey()) != null); }
/** * Removes the last element returned from the {@link #next()} method from * the sequenced map. * * @throws IllegalStateException if there isn't a "last element" to be * removed. That is, if {@link #next()} has never been called, or if * {@link #remove()} was already called on the element. * * @throws ConcurrentModificationException if a modification occurs in * the underlying map. */ public void remove() { if ((returnType & REMOVED_MASK) != 0) { throw new java.lang.IllegalStateException("remove() must follow next()"); } if (root.modCount != expectedModCount) { throw new java.util.ConcurrentModificationException(); } root.removeImpl(pos.getKey()); // update the expected mod count for the remove operation expectedModCount++; // set the removed flag returnType = returnType | REMOVED_MASK; }
public override bool remove(Object o) { Entry e = root.removeImpl(o); return(e != null); }