in sources/java-incremental-compilation/jvm-inc-builder/src/com/intellij/tools/build/bazel/org/jdom/ContentList.java [955:989]
private int resync(final int index) {
if (xdata != getDataModCount()) {
// The underlying list was modified somehow...
// we need to invalidate our research...
xdata = getDataModCount();
backingsize = 0;
if (size >= backingpos.length) {
backingpos = new int[size + 1];
}
}
if (index >= 0 && index < backingsize) {
// we have already indexed far enough...
// return the backing index.
return backingpos[index];
}
// the index in the backing list of the next value to check.
int bpi = 0;
if (backingsize > 0) {
bpi = backingpos[backingsize - 1] + 1;
}
while (bpi < size) {
final F gotit = filter.filter(elementData[bpi]);
if (gotit != null) {
backingpos[backingsize] = bpi;
if (backingsize++ == index) {
return bpi;
}
}
bpi++;
}
return size;
}