Change this

ArrayUtils.remove(listItems, i);

to

listItems = ArrayUtils.remove(listItems, i);

As you can see in the JavaDoc, the method does not change the argument listItems, rather it returns a new array with the remaining elements.

Edit

You also need to change your deletion method to

public static ItemTracker[] deleteItem(ItemTracker[] listItems) {
    //..
}

So you could return the new array with the remaining elements.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *