Hapus fungsional Java

public int remove(int index)
    {
        checkIndex(index, 0, size-1);
        for (int i = index; i <= size; i++)
        {
            elementData[i] = elementData[i+1];
        }
        elementData[size] = 0;
        size--;
        return elementData[index];
    }
Sid Potti