### Question:
SortedList extends TransformedList<E,E> { public int sortIndex(Object object) { if (comparator == null) throw new IllegalStateException("No Comparator exists to perform this operation"); return ((SimpleTree)sorted).indexOfValue(object, true, true, ALL_COLORS); } SortedList(EventList<E> source);  SortedList(EventList<E> source, Comparator<? super E> comparator); static SortedList<E> create(EventList<E> source); void setMode(int mode); int getMode(); @Override void listChanged(ListEvent<E> listChanges); Comparator<? super E> getComparator(); void setComparator(Comparator<? super E> comparator); @Override int indexOf(Object object); @Override int lastIndexOf(Object object); int sortIndex(Object object); int lastSortIndex(Object object); @Deprecated int indexOfSimulated(Object object); @Override boolean contains(Object object); @Override Iterator<E> iterator(); static final int STRICT_SORT_ORDER; static final int AVOID_MOVING_ELEMENTS; }### Answer:
@Test public void testSortIndex() { sortedList.addAll(GlazedListsTests.stringToList("ac")); assertEquals(1, sortedList.sortIndex("b")); assertEquals(1, sortedList.lastSortIndex("b")); sortedList.clear(); sortedList.addAll(GlazedListsTests.stringToList("abbbc")); assertEquals(1, sortedList.sortIndex("b")); assertEquals(3, sortedList.lastSortIndex("b")); assertEquals(0, sortedList.sortIndex("3")); assertEquals(0, sortedList.lastSortIndex("3")); assertEquals(5, sortedList.sortIndex("d")); assertEquals(5, sortedList.lastSortIndex("d")); }