in commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/AbstractBucketPointMap.java [853:881]
public Entry<P, V> removeEntryAlongIndexPath(final int idx) {
if (isLeaf()) {
if (!entries.isEmpty()) {
// remove the last entry in the list
final Entry<P, V> entry = entries.remove(entries.size() - 1);
subtreeEntryRemoved();
return entry;
}
} else {
final int childCount = children.size();
final int delta = idx < (map.nodeChildCount / 2) ?
+1 :
-1;
for (int n = 0, i = idx;
n < childCount;
++n, i += delta) {
final int adjustedIndex = (i + childCount) % childCount;
final Entry<P, V> entry = removeEntryAlongIndexPathFromChild(adjustedIndex, idx);
if (entry != null) {
return entry;
}
}
}
return null;
}