diff --git a/src/main/java/core/basesyntax/ArrayList.java b/src/main/java/core/basesyntax/ArrayList.java index d925b1591..72654bd04 100644 --- a/src/main/java/core/basesyntax/ArrayList.java +++ b/src/main/java/core/basesyntax/ArrayList.java @@ -1,6 +1,5 @@ package core.basesyntax; - import java.util.NoSuchElementException; public class ArrayList implements List { @@ -99,7 +98,8 @@ public T remove(T element) { } if (arrayIndex !=0) { Object[] newArray = new Object[arrayLength]; - System.arraycopy(array, arrayIndex, newArray, arrayIndex-1, arraySize - arrayIndex); + System.arraycopy(array, arrayIndex, newArray, arrayIndex, arraySize); + System.arraycopy(array, arrayIndex+1, newArray, arrayIndex, arraySize - arrayIndex); array = newArray; arraySize--; }