sclass ImmutableSortedList extends AbstractList {
O[] array;
*() { array = emptyObjectArray(); }
*(Collection extends A> elements) {
main.sort(array = toObjectArray(elements));
}
public int size() { ret l(array); }
public A get(int i) {
ret (A) array[i];
}
public int indexOf(O o) {
ret max(-1, Arrays.binarySearch(array, o));
}
public bool contains(O o) {
ret indexOf(o) >= 0;
}
}