Browse Source

ObjectIdSubclassMap: Correct Iterator to throw NoSuchElementException

The Iterator contract says next() shall throw NoSuchElementException
if there are no more items remaining in the iteration.  We got this
wrong when I originally wrote the implementation, so fix it.

Change-Id: Iea25e6569ead5c8b3128b8a368c5b2caebec7ecc
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
stable-0.8
Shawn O. Pearce 15 years ago
parent
commit
466bec3cc9
  1. 3
      org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java

3
org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java

@ -46,6 +46,7 @@
package org.eclipse.jgit.lib;
import java.util.Iterator;
import java.util.NoSuchElementException;
/**
* Fast, efficient map specifically for {@link ObjectId} subclasses.
@ -158,7 +159,7 @@ public class ObjectIdSubclassMap<V extends ObjectId> implements Iterable<V> {
return v;
}
}
throw new IllegalStateException();
throw new NoSuchElementException();
}
public void remove() {

Loading…
Cancel
Save