The following text was written to the standard output stream when the WordList program was executed from IntelliJ.
/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java -javaagent:/opt/intellij-idea-community/lib/idea_rt.jar=44243:/opt/intellij-idea-community/bin -Dfile.encoding=UTF-8 -classpath /home/kgargui2/IdeaProjects/CS1/out/production/CS1:/home/kgargui2/SimplePainter.jar:/home/kgargui2/SimpleComposer.jar:/home/kgargui2/jfugue-4.0.3-with-musicxml.jar arraylistplay.WordList >>> help HELP - display a menu of commands DISPLAY - display the list of numbers PRINT - print a number (FIRST;LAST;nth) SWAP - exchange two elements (nth;mth) ADD - add a number to the list (FIRST;LAST) EXIT - terminate execution of the program >>> display the on some time funny not bright summer sun vacation math school home mom music bed relax beach ball computer >>> print first the >>> print last computer >>> print 3 some >>> print 18 beach >>> swap 5 7 >>> display the on some time bright not funny summer sun vacation math school home mom music bed relax beach ball computer >>> swap 1 18 >>> display beach on some time bright not funny summer sun vacation math school home mom music bed relax the ball computer >>> help HELP - display a menu of commands DISPLAY - display the list of numbers PRINT - print a number (FIRST;LAST;nth) SWAP - exchange two elements (nth;mth) ADD - add a number to the list (FIRST;LAST) EXIT - terminate execution of the program >>> add first hi Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 20 out of bounds for length 20 at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64) at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70) at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248) at java.base/java.util.Objects.checkIndex(Objects.java:372) at java.base/java.util.ArrayList.set(ArrayList.java:472) at arraylistplay.WordList.addFirst(WordList.java:127) at arraylistplay.WordList.interpretAddCommand(WordList.java:114) at arraylistplay.WordList.interpreter(WordList.java:65) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.interpreter(WordList.java:73) at arraylistplay.WordList.main(WordList.java:24) Process finished with exit code 1