diff options
| -rw-r--r-- | core/java/android/util/MapCollections.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/core/java/android/util/MapCollections.java b/core/java/android/util/MapCollections.java index 28b788b97aa7..80ab23c8261d 100644 --- a/core/java/android/util/MapCollections.java +++ b/core/java/android/util/MapCollections.java @@ -22,6 +22,7 @@ import java.lang.reflect.Array; import java.util.Collection; import java.util.Iterator; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Set; /** @@ -52,6 +53,7 @@ abstract class MapCollections<K, V> { @Override public T next() { + if (!hasNext()) throw new NoSuchElementException(); Object res = colGetEntry(mIndex, mOffset); mIndex++; mCanRemove = true; @@ -87,6 +89,7 @@ abstract class MapCollections<K, V> { @Override public Map.Entry<K, V> next() { + if (!hasNext()) throw new NoSuchElementException(); mIndex++; mEntryValid = true; return this; |