static O smallestList_remove(O l, O o) { int i = smallestList_indexOf(l, o); if (i < 0) ret l; // Nothing to do // TODO: optimize (if necessary) L list = smallestList_toMutableList(l); list.remove(i); ret smallestList_fromList(list); }