static bool addOrMoveToStart(L l, A a) { int i = l.indexOf(a); if (i == 0) false; if (i > 0) l.remove(i); l.add(0, a); true; }