public static IntIndexedContainer withoutConsecutiveDuplicates(IntIndexedContainer arr) {
        IntArrayList result = new IntArrayList();
        if (arr.isEmpty())
            return result;
        int prev = arr.get(0);
        result.add(prev);
        for (int i = 1; i < arr.size(); i++) {
            int val = arr.get(i);
            if (val != prev)
                result.add(val);
            prev = val;
        }
        return result;
    }
@Test
    public void testWithoutConsecutiveDuplicates() {
        assertEquals(from(), ArrayUtil.withoutConsecutiveDuplicates(from()));
        assertEquals(from(1), ArrayUtil.withoutConsecutiveDuplicates(from(1)));
        assertEquals(from(1), ArrayUtil.withoutConsecutiveDuplicates(from(1, 1)));
        assertEquals(from(1), ArrayUtil.withoutConsecutiveDuplicates(from(1, 1, 1)));
        assertEquals(from(1, 2), ArrayUtil.withoutConsecutiveDuplicates(from(1, 1, 2)));
        assertEquals(from(1, 2, 1), ArrayUtil.withoutConsecutiveDuplicates(from(1, 2, 1)));
        assertEquals(
                from(5, 6, 5, 8, 9, 11, 2, -1, 3),
                ArrayUtil.withoutConsecutiveDuplicates(from(5, 5, 5, 6, 6, 5, 5, 8, 9, 11, 11, 2, 2, -1, 3, 3)));
    }