»»

java.util errorsJava Runtime

Top patterns

  1. JVM ran out of heap space while trying to create a copy of an existing array

    In Eclipse : go to Run --> Run Configurations --> then select the project under maven build --> then select the tab "JRE" --> then enter -Xmx1024m.

    This should increase the memory heap for all the builds/projects. The above memory size is 1 GB.

    Check the source of this solution for more info

  2. Index provided to the ArrayList method is either greater or equal to size of the list or less than 0
    No solution
  3. Multiple threads trying to modify ArrayList at the same time or trying to modify ArrayList while iterating over it

    In order to avoid more than one threads accessing or modifying the same object, you can synchronize them over the object, in order to allow only one thread to manipulate it over time.

    Check the source of this solution for more info

Error patternsClassesMethodsExceptions
DescriptionException TypeEntry MethodWeb pages

JVM ran out of heap space while trying to create a copy of an existing array

java.lang.OutOfMemoryError
java.util.Arrays.copyOf
1424Web pages
1Solution
OutOfMemoryErrorArrays.copyOf1424

Index provided to the ArrayList method is either greater or equal to size of the list or less than 0

java.lang.IndexOutOfBoundsException
java.util.ArrayList.RangeCheck
1169Web pages
IndexOutOfBoundsExceptionArrayList.RangeCheck1169

Multiple threads trying to modify ArrayList at the same time or trying to modify ArrayList while iterating over it

java.util.ConcurrentModificationException
java.util.ArrayList$Itr.checkForComodification
1039Web pages
1Solution
ConcurrentModificationExceptionArrayList$Itr.checkForComodification1039

Trying to modify a HashMap directly while iterating over it

java.util.ConcurrentModificationException
java.util.HashMap$HashIterator.nextEntry
959Web pages
1Solution
ConcurrentModificationExceptionHashMap$HashIterator.nextEntry959

Trying to add an entry to a null HashTable

java.lang.NullPointerException
java.util.Hashtable.put
706Web pages
1Solution
NullPointerExceptionHashtable.put706

ResourceBundle.getBundleImpl() has thrown a MissingResourceException

java.util.MissingResourceException
1 frames hidden
java.util.ResourceBundle.getBundleImpl
612Web pages
MissingResourceExceptionResourceBundle.getBundleImpl612

Vector.elementAt() has thrown an ArrayIndexOutOfBoundsException

java.lang.ArrayIndexOutOfBoundsException
java.util.Vector.elementAt
608Web pages
ArrayIndexOutOfBoundsExceptionVector.elementAt608

Scanner.throwFor() has thrown an InputMismatchException

java.util.InputMismatchException
java.util.Scanner.throwFor
558Web pages
InputMismatchExceptionScanner.throwFor558

AbstractList$Itr.checkForComodification() has thrown a ConcurrentModificationException

java.util.ConcurrentModificationException
java.util.AbstractList$Itr.checkForComodification
557Web pages
ConcurrentModificationExceptionAbstractList$Itr.checkForComodification557

Scanner.throwFor() has thrown a NoSuchElementException

java.util.NoSuchElementException
java.util.Scanner.throwFor
516Web pages
NoSuchElementExceptionScanner.throwFor516

HashMap$HashIterator.nextNode() has thrown a ConcurrentModificationException

java.util.ConcurrentModificationException
java.util.HashMap$HashIterator.nextNode
477Web pages
ConcurrentModificationExceptionHashMap$HashIterator.nextNode477

ArrayList.elementData() has thrown an ArrayIndexOutOfBoundsException

java.lang.ArrayIndexOutOfBoundsException
java.util.ArrayList.elementData
400Web pages
1Solution
ArrayIndexOutOfBoundsExceptionArrayList.elementData400

ResourceBundle.getObject() has thrown a MissingResourceException

java.util.MissingResourceException
java.util.ResourceBundle.getObject
396Web pages
MissingResourceExceptionResourceBundle.getObject396

Arrays.copyOfRange() has thrown an OutOfMemoryError

java.lang.OutOfMemoryError
java.util.Arrays.copyOfRange
363Web pages
OutOfMemoryErrorArrays.copyOfRange363

Objects.requireNonNull() has thrown a NullPointerException

java.lang.NullPointerException
java.util.Objects.requireNonNull
325Web pages
NullPointerExceptionObjects.requireNonNull325

ServiceLoader.fail() has thrown a ServiceConfigurationError

java.util.ServiceConfigurationError
java.util.ServiceLoader.fail
286Web pages
ServiceConfigurationErrorServiceLoader.fail286

Random.nextInt() has thrown an IllegalArgumentException

java.lang.IllegalArgumentException
java.util.Random.nextInt
274Web pages
IllegalArgumentExceptionRandom.nextInt274

Scanner.nextLine() has thrown a NoSuchElementException

java.util.NoSuchElementException
java.util.Scanner.nextLine
269Web pages
NoSuchElementExceptionScanner.nextLine269

Trying to access element at index outside the bounds of the ArrayList

java.lang.IndexOutOfBoundsException
java.util.ArrayList.get
266Web pages
1Solution
IndexOutOfBoundsExceptionArrayList.get266

Properties$LineReader.readLine() has thrown a NullPointerException

java.lang.NullPointerException
java.util.Properties$LineReader.readLine
264Web pages
NullPointerExceptionProperties$LineReader.readLine264

StringTokenizer.nextToken() has thrown a NoSuchElementException

java.util.NoSuchElementException
java.util.StringTokenizer.nextToken
254Web pages
NoSuchElementExceptionStringTokenizer.nextToken254

Stack.peek() has thrown an EmptyStackException

java.util.EmptyStackException
java.util.Stack.peek
245Web pages
EmptyStackExceptionStack.peek245

TimSort.mergeLo() has thrown an IllegalArgumentException

java.lang.IllegalArgumentException
java.util.TimSort.mergeLo
199Web pages
IllegalArgumentExceptionTimSort.mergeLo199

LinkedList$ListItr.checkForComodification() has thrown a ConcurrentModificationException

java.util.ConcurrentModificationException
java.util.LinkedList$ListItr.checkForComodification
198Web pages
ConcurrentModificationExceptionLinkedList$ListItr.checkForComodification198

Calling get() method on an empty Optional object

java.util.NoSuchElementException
java.util.Optional.get
190Web pages
1Solution
NoSuchElementExceptionOptional.get190

AbstractList.add() has thrown an UnsupportedOperationException

java.lang.UnsupportedOperationException
java.util.AbstractList.add
183Web pages
UnsupportedOperationExceptionAbstractList.add183

Hashtable.get() has thrown a NullPointerException

java.lang.NullPointerException
java.util.Hashtable.get
176Web pages
NullPointerExceptionHashtable.get176

TimSort.mergeHi() has thrown an IllegalArgumentException

java.lang.IllegalArgumentException
java.util.TimSort.mergeHi
174Web pages
IllegalArgumentExceptionTimSort.mergeHi174

LinkedHashMap$LinkedHashIterator.nextEntry() has thrown a ConcurrentModificationException

java.util.ConcurrentModificationException
java.util.LinkedHashMap$LinkedHashIterator.nextEntry
169Web pages
ConcurrentModificationExceptionLinkedHashMap$LinkedHashIterator.nextEntry169

Formatter$FormatSpecifier.failConversion() has thrown an IllegalFormatConversionException

java.util.IllegalFormatConversionException
java.util.Formatter$FormatSpecifier.failConversion
160Web pages
IllegalFormatConversionExceptionFormatter$FormatSpecifier.failConversion160

AbstractList$Itr.next() has thrown a NoSuchElementException

java.util.NoSuchElementException
java.util.AbstractList$Itr.next
152Web pages
NoSuchElementExceptionAbstractList$Itr.next152

Vector.get() has thrown an ArrayIndexOutOfBoundsException

java.lang.ArrayIndexOutOfBoundsException
java.util.Vector.get
149Web pages
ArrayIndexOutOfBoundsExceptionVector.get149

ArrayList.addAll() has thrown a NullPointerException

java.lang.NullPointerException
java.util.ArrayList.addAll
145Web pages
NullPointerExceptionArrayList.addAll145

ArrayList$Itr.next() has thrown a NoSuchElementException

java.util.NoSuchElementException
java.util.ArrayList$Itr.next
136Web pages
NoSuchElementExceptionArrayList$Itr.next136

StringTokenizer.<init>() has thrown a NullPointerException

java.lang.NullPointerException
java.util.StringTokenizer.<init>
133Web pages
NullPointerExceptionStringTokenizer.<init>133

Timer.sched() has thrown an IllegalStateException

java.lang.IllegalStateException
java.util.Timer.sched
132Web pages
IllegalStateExceptionTimer.sched132

Trying to call setTime() on a null Calendar object

java.lang.NullPointerException
java.util.Calendar.setTime
121Web pages
1Solution
NullPointerExceptionCalendar.setTime121

AbstractList.remove() has thrown an UnsupportedOperationException

java.lang.UnsupportedOperationException
java.util.AbstractList.remove
119Web pages
UnsupportedOperationExceptionAbstractList.remove119

TreeMap$PrivateEntryIterator.nextEntry() has thrown a ConcurrentModificationException

java.util.ConcurrentModificationException
java.util.TreeMap$PrivateEntryIterator.nextEntry
117Web pages
ConcurrentModificationExceptionTreeMap$PrivateEntryIterator.nextEntry117

LinkedList.checkElementIndex() has thrown an IndexOutOfBoundsException

java.lang.IndexOutOfBoundsException
java.util.LinkedList.checkElementIndex
114Web pages
IndexOutOfBoundsExceptionLinkedList.checkElementIndex114

Collections$EmptyList.get() has thrown an IndexOutOfBoundsException

java.lang.IndexOutOfBoundsException
java.util.Collections$EmptyList.get
114Web pages
IndexOutOfBoundsExceptionCollections$EmptyList.get114

Arrays.asList() has thrown a NullPointerException

java.lang.NullPointerException
1 frames hidden
java.util.Arrays.asList
108Web pages
NullPointerExceptionArrays.asList108

Formatter.checkText() has thrown an UnknownFormatConversionException

java.util.UnknownFormatConversionException
java.util.Formatter.checkText
103Web pages
UnknownFormatConversionExceptionFormatter.checkText103

Formatter.format() has thrown a MissingFormatArgumentException

java.util.MissingFormatArgumentException
java.util.Formatter.format
102Web pages
MissingFormatArgumentExceptionFormatter.format102

TreeMap.compare() has thrown a ClassCastException

java.lang.ClassCastException
java.util.TreeMap.compare
101Web pages
ClassCastExceptionTreeMap.compare101

LinkedHashMap$LinkedHashIterator.nextNode() has thrown a ConcurrentModificationException

java.util.ConcurrentModificationException
java.util.LinkedHashMap$LinkedHashIterator.nextNode
96Web pages
ConcurrentModificationExceptionLinkedHashMap$LinkedHashIterator.nextNode96

HashMap$HashIterator.nextEntry() has thrown a NoSuchElementException

java.util.NoSuchElementException
java.util.HashMap$HashIterator.nextEntry
91Web pages
NoSuchElementExceptionHashMap$HashIterator.nextEntry91

EventObject.<init>() has thrown an IllegalArgumentException

java.lang.IllegalArgumentException
java.util.EventObject.<init>
90Web pages
IllegalArgumentExceptionEventObject.<init>90

AbstractQueue.add() has thrown an IllegalStateException

java.lang.IllegalStateException
java.util.AbstractQueue.add
84Web pages
IllegalStateExceptionAbstractQueue.add84

Properties.loadConvert() has thrown an IllegalArgumentException

java.lang.IllegalArgumentException
java.util.Properties.loadConvert
79Web pages
IllegalArgumentExceptionProperties.loadConvert79
Nothing to list here.
Nothing to list here.
Nothing to list here.