in src/main/java/org/apache/sling/resourceresolver/impl/mapping/MapEntryIterator.java [88:127]
private void seek() {
// compute candidate for next entry from global list
if (this.nextGlobal == null && this.globalListIterator.hasNext()) {
this.nextGlobal = this.globalListIterator.next();
}
// compute candidate for next entry from "special" vanity path list
if (this.nextSpecial == null) {
// reset specialIterator when exhausted
if (!this.specialIterator.hasNext()) {
this.specialIterator = Collections.emptyIterator();
}
// given the vanity path in key, walk up the hierarchy until we find
// map entries for that path (or stop when root is reached)
while (!this.specialIterator.hasNext() && this.key != null) {
this.key = removeSelectorsAndExtension(this.key);
this.specialIterator =
nullIteratorToEmpty(this.getCurrentMapEntryIteratorForVanityPath.apply(this.key));
this.key = getParent(key);
}
if (this.specialIterator.hasNext()) {
this.nextSpecial = this.specialIterator.next();
}
}
// choose based on presence, vanity path preferences and pattern lengths
if (useNextGlobal()) {
this.next = this.nextGlobal;
this.nextGlobal = null;
} else {
this.next = this.nextSpecial;
this.nextSpecial = null;
}
}