\"Exception in thread \"main\" java.lang.IndexOutOfBoundsException: Index: 0, Size: 0\" is the main error I get when I compile this method:
public static Arr
Do not use list.set(index, element) on a nonexistent element, since it replaces the old (nonexistent) element with a new one and returns the old one. Instead, use list.add(index, element) and it will work.
list.set(index, element)
list.add(index, element)