Use this tag if your problem is caused by or primarily involves a NoSuchElementException in Java.
The NoSuchElementException
is a RuntimeException
thrown by the nextElement
method of an Enumeration
to indicate that there are no more elements in the enumeration.
It is also thrown by:
- the various
next*
methods (nextInt
,nextFloat
,nextLine
,...) of theScanner
class when input is exhausted; - the
get
method of the Java 8Optional
class when a value is not present; - the methods
firstElement
andlastElement
in theVector
class when there are no elements; - the methods
firstKey
andlastKey
in theTreeMap
class when there are no keys; - the methods
getFirst
,getLast
,removeFirst
andremoveLast
inLinkedList
when there are no elements;
and other collections.