Question: When I test my add method for the ArrayStringList with one element, it shows 2 . For example, when I add ( 0 ,

When I test my add method for the ArrayStringList with one element, it shows 2. For example, when I add(0,"a"), the list looks like [a, a]. What could be the bug? The javadoc API says: Inserts an item into this string list at the specified index position. If an item was already at that position, then that item and subsequent items are shifted to the right (i.e., one is added to their indices). It throws a NullPointerException - if item is null, an IllegalArgumentException - if item is empty, and an IndexOutOfBoundsException - if index is out of range (index 0|| index > size())
 When I test my add method for the ArrayStringList with one

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!