mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
VCS: area map: contains(); [a/c, a/c/d] to insert a/c/e case -> check all occurencies before found insert place
This commit is contained in:
@@ -67,6 +67,10 @@ public class AreaMap<Key extends Comparable<Key>, Val> {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean contains(final Key key) {
|
||||
return myKeys.contains(key);
|
||||
}
|
||||
|
||||
public void getSimiliar(final Key key, final PairProcessor<Key, Val> consumer) {
|
||||
final int idx = Collections.binarySearch(myKeys, key);
|
||||
if (idx < 0) {
|
||||
@@ -76,7 +80,7 @@ public class AreaMap<Key extends Comparable<Key>, Val> {
|
||||
if (itemBeforeIdx >= 0) {
|
||||
for (int i = itemBeforeIdx; i >= 0; -- i) {
|
||||
final Key candidate = myKeys.get(i);
|
||||
if (! myKeysResemblance.process(candidate, key)) break;
|
||||
if (! myKeysResemblance.process(candidate, key)) continue;
|
||||
if (consumer.process(candidate, myMap.get(candidate))) break; // if need only a part of keys
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user