abstract sclass ListEntryWithPrevAndNext implements IVarWithPrevAndNext> { } static ListEntryWithPrevAndNext listEntryWithPrevAndNext(L l, int idx) { if (idx < 0 || idx >= l(l)) null; ret new ListEntryWithPrevAndNext() { pulic A get() { ret get(l, idx); } public void set(A a) { l.put(idx, a); } public ListEntryWithPrevAndNext prev() { ret ListEntryWithPrevAndNext(l, idx-1); } public ListEntryWithPrevAndNext next() { ret ListEntryWithPrevAndNext(l, idx+1); } }; }