public COSBase remove( int i )
    {
        COSBase removedEntry = objects.remove( i );
        getUpdateState().update();
        return removedEntry;
    }
@Test
    void testRemove()
    {
        COSArray cosArray = COSArray
                .ofCOSIntegers(Arrays.asList(1, 2, 3, 4, 5, 6));
        cosArray.clear();
        assertEquals(0, cosArray.size());

        cosArray = COSArray.ofCOSIntegers(Arrays.asList(1, 2, 3, 4, 5, 6));
        assertEquals(COSInteger.get(3), cosArray.remove(2));
        // 1,2,4,5,6 should be left
        assertEquals(5, cosArray.size());
        assertEquals(1, cosArray.getInt(0));
        assertEquals(4, cosArray.getInt(2));

        // 1,2,4,6 should be left
        assertTrue(cosArray.removeObject(COSInteger.get(5)));
        assertEquals(4, cosArray.size());
        assertEquals(1, cosArray.getInt(0));
        assertEquals(4, cosArray.getInt(2));
        assertEquals(6, cosArray.getInt(3));

        cosArray = COSArray.ofCOSIntegers(Arrays.asList(1, 2, 3, 4, 5, 6));
        cosArray.removeAll(Arrays.asList(COSInteger.get(3), COSInteger.get(4)));
        // 1,2,5,6 should be left
        assertEquals(4, cosArray.size());
        assertEquals(2, cosArray.getInt(1));
        assertEquals(5, cosArray.getInt(2));

        cosArray = COSArray.ofCOSIntegers(Arrays.asList(1, 2, 3, 4, 5, 6));
        cosArray.retainAll(Arrays.asList(COSInteger.get(3), COSInteger.get(4)));
        // 3,4 should be left
        assertEquals(2, cosArray.size());
        assertEquals(3, cosArray.getInt(0));
        assertEquals(4, cosArray.getInt(1));

    }