static L> ai_triplesToTripleRefs_lazyList(fS searchTerm, final L l) { ret new LazyList>() { final int n = l(l); public int size() { ret n; } public TripleRef get(int i) { TripleWeb w = l.get(i); // run-length magic int runLength = 0; while (i-runLength > 0 && l.get(i-runLength-1) == w) ++runLength; ret ai_tripleToTripleRef(l.get(i), searchTerm, runLength); } }; }