public boolean removeIfInt(final IntPredicate filter)
    {
        requireNonNull(filter);
        final int[] elements = this.elements;
        @DoNotSub final int size = this.size;
        if (size > 0)
        {
            int[] filteredElements = null;
            @DoNotSub int j = -1;
            for (@DoNotSub int i = 0; i < size; i++)
            {
                final int value = elements[i];
                if (filter.test(value))
                {
                    if (null == filteredElements)
                    {
                        filteredElements = Arrays.copyOf(elements, size);
                        j = i - 1;
                    }
                }
                else if (null != filteredElements)
                {
                    filteredElements[++j] = value;
                }
            }

            if (null != filteredElements)
            {
                this.elements = filteredElements;
                this.size = j + 1;
                return true;
            }
        }
        return false;
    }
@Test
    void removeIfIntThrowsNullPointerExceptionIsFilterIsNull()
    {
        assertThrowsExactly(NullPointerException.class, () -> list.removeIfInt(null));
    }