IntegerList implements SortedSet<Integer>, List<Integer> { @Pure @Override public int indexOf(Object obj) { if (obj instanceof Number) { final int e = ((Number) obj).intValue(); if (this.values != null) { int idx = 0; for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) { for (int n = this.values[idxStart]; n <= this.values[idxStart + 1]; ++n) { if (n == e) { return idx; } ++idx; } } } return -1; } if (obj == null) { throw new NullPointerException(); } throw new ClassCastException(); } 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 indexOfObject() { assertEquals(-1, this.list.indexOf(Integer.valueOf(0))); assertEquals(0, this.list.indexOf(Integer.valueOf(1))); assertEquals(1, this.list.indexOf(Integer.valueOf(2))); assertEquals(2, this.list.indexOf(Integer.valueOf(3))); assertEquals(-1, this.list.indexOf(Integer.valueOf(4))); assertEquals(-1, this.list.indexOf(Integer.valueOf(5))); assertEquals(-1, this.list.indexOf(Integer.valueOf(6))); assertEquals(-1, this.list.indexOf(Integer.valueOf(7))); assertEquals(-1, this.list.indexOf(Integer.valueOf(8))); assertEquals(-1, this.list.indexOf(Integer.valueOf(9))); assertEquals(3, this.list.indexOf(Integer.valueOf(10))); assertEquals(-1, this.list.indexOf(Integer.valueOf(11))); assertEquals(-1, this.list.indexOf(Integer.valueOf(12))); assertEquals(-1, this.list.indexOf(Integer.valueOf(13))); assertEquals(-1, this.list.indexOf(Integer.valueOf(14))); assertEquals(-1, this.list.indexOf(Integer.valueOf(15))); assertEquals(-1, this.list.indexOf(Integer.valueOf(16))); assertEquals(-1, this.list.indexOf(Integer.valueOf(17))); assertEquals(-1, this.list.indexOf(Integer.valueOf(18))); assertEquals(-1, this.list.indexOf(Integer.valueOf(19))); assertEquals(4, this.list.indexOf(Integer.valueOf(20))); assertEquals(5, this.list.indexOf(Integer.valueOf(21))); assertEquals(6, this.list.indexOf(Integer.valueOf(22))); assertEquals(7, this.list.indexOf(Integer.valueOf(23))); assertEquals(8, this.list.indexOf(Integer.valueOf(24))); assertEquals(9, this.list.indexOf(Integer.valueOf(25))); assertEquals(-1, this.list.indexOf(Integer.valueOf(26))); assertEquals(-1, this.list.indexOf(Integer.valueOf(27))); assertEquals(-1, this.list.indexOf(Integer.valueOf(28))); assertEquals(-1, this.list.indexOf(Integer.valueOf(29))); assertEquals(-1, this.list.indexOf(Integer.valueOf(30))); }