static A latest(Class c) { long maxID = 0; A max = null; for (A a : list(c)) if (a.id > maxID) { maxID = a.id; max = a; } ret max; // This doesn't work: //ret last(list(c)); // todo: optimize? }