IntVec { private IntVec(int capacity) { data = new int[capacity]; len = 0; } private  IntVec(int capacity); private  IntVec(int[] data); static IntVec create(); static IntVec withCapacity(int capacity); static IntVec wrap(int[] data); int capacity(); int len(); boolean isEmpty(); void reserve(int additional); void reserveExact(int additional); void shrinkToFit(); void truncate(int len); void clear(); void push(int element); void set(int index, int value); void concat(IntVec other); int get(int index); void sort(); void merge(IntVec other); void intersect(IntVec other); void dedup(); Iterator iterator(); List<Integer> asList(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testIntVec() throws Exception { checkIntVec(random(0)); checkIntVec(random(1)); checkIntVec(random(2)); checkIntVec(random(3)); checkIntVec(random(IntVec.DEFAULT_CAPACITY - 2)); checkIntVec(random(IntVec.DEFAULT_CAPACITY - 1)); checkIntVec(random(IntVec.DEFAULT_CAPACITY)); checkIntVec(random(IntVec.DEFAULT_CAPACITY + 1)); checkIntVec(random(IntVec.DEFAULT_CAPACITY + 2)); for (int i = 0; i < 100; i++) { checkIntVec(random()); } }