IntegerList implements SortedSet<Integer>, List<Integer> { @Override @Pure public Integer get(int index) { if (this.values == null) { throw new IndexOutOfBoundsException(Integer.toString(index)); } int firstIndex = 0; for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) { final int endIndex = this.values[idxStart + 1] - this.values[idxStart] + firstIndex; if ((index >= firstIndex) && (index <= endIndex)) { return this.values[idxStart] + index - firstIndex; } firstIndex = endIndex + 1; } throw new IndexOutOfBoundsException(Integer.toString(index)); } IntegerList();  IntegerList(int value);  IntegerList(int start, int end);  IntegerList(Collection<? extends Integer> collection); @Pure @Override String toString(); @Pure @Inline(value = "null", constantExpression = true) @Override Comparator<? super Integer> comparator(); @Pure @Override Integer first(); @Pure @Override SortedSet<Integer> headSet(Integer toElement); @Pure @Override Integer last(); @Pure @Override SortedSet<Integer> subSet(Integer fromElement, Integer toElement); @Pure @Override SortedSet<Integer> tailSet(Integer fromElement); @Override final void add(int index, Integer element); @Override boolean add(Integer value); @Override final boolean addAll(int index, Collection<? extends Integer> collection); @Override boolean addAll(Collection<? extends Integer> collection); @Override void clear(); @Pure @Override boolean contains(Object obj); @Pure @Override boolean containsAll(Collection<?> collection); @Pure @Override boolean isEmpty(); @Pure @Override Iterator<Integer> iterator(); @Pure Iterator<IntegerSegment> segmentIterator(); @Pure Iterable<IntegerSegment> toSegmentIterable(); @Override boolean remove(Object obj); @Override Integer remove(int index); @Override boolean removeAll(Collection<?> collection); @Override boolean retainAll(Collection<?> collection); @Override Integer set(int index, Integer element); void set(SortedSet<? extends Number> collection); @Pure @Override int size(); @Override @Pure Integer get(int index); @Override @Pure Object[] toArray(); @Override @SuppressWarnings("unchecked") T[] toArray(T[] array); @Pure int[] toIntArray(); @Pure SortedSet<Integer> toSortedSet(); @Pure @Override int indexOf(Object obj); @Pure @Override int lastIndexOf(Object obj); @Pure @Override ListIterator<Integer> listIterator(); @Pure @Override ListIterator<Integer> listIterator(int index); @Pure @Override List<Integer> subList(int fromIndex, int toIndex); @Pure @Override Spliterator<Integer> spliterator();  }
@Test public void getIntIntArray() { int[] tab = new int[2]; assertTrue(this.list.get(0, tab)); assertEquals(0, tab[0]); assertEquals(1, tab[1]); assertTrue(this.list.get(1, tab)); assertEquals(0, tab[0]); assertEquals(2, tab[1]); assertTrue(this.list.get(2, tab)); assertEquals(0, tab[0]); assertEquals(3, tab[1]); assertTrue(this.list.get(3, tab)); assertEquals(2, tab[0]); assertEquals(10, tab[1]); assertTrue(this.list.get(4, tab)); assertEquals(4, tab[0]); assertEquals(20, tab[1]); }
@Test public void getInt() { assertEquals(Integer.valueOf(1), this.list.get(0)); assertEquals(Integer.valueOf(2), this.list.get(1)); assertEquals(Integer.valueOf(3), this.list.get(2)); assertEquals(Integer.valueOf(10), this.list.get(3)); assertEquals(Integer.valueOf(20), this.list.get(4)); assertEquals(Integer.valueOf(21), this.list.get(5)); assertEquals(Integer.valueOf(22), this.list.get(6)); assertEquals(Integer.valueOf(23), this.list.get(7)); assertEquals(Integer.valueOf(24), this.list.get(8)); assertEquals(Integer.valueOf(25), this.list.get(9)); }