-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
beta
-
x86
-
windows_98
-
Verified
Name: jb33418 Date: 09/28/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
This bug is related to the ListIterator returned from ArrayList.listIterator().
It occurs when the list is empty.
The hasNext() method incorrectly returns True after a failed call to previous
().
The behaviour expected is hasNext() should always return False when the
ArrayList is empty.
The follow code demostrates the problem;
ArrayList list = new ArrayList();
ListIterator i = list.listIterator();
try {
i.previous();
}
catch (NoSuchElementException e) {}
// result should be False but is True!!
boolean result = i.hasNext();
(Review ID: 108017)
======================================================================