You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assumption: entries are searched more often than added and removed. Then, it is "faster" to update indexes on entry addition/removed than "huge" search effort.
Currently, binarySearch is used. Which also should be fast for larger databases. If not, this issue provides a hint how to fix.
We tried with a first approach, but the indexes are not updated out of the list.
privatevoidinitializeEntryIndexMap() {
for (inti = 0; i < allEntries.size(); i++) {
entryIndexMap.put(allEntries.get(i).getId(), i);
}
allEntries.addListener((ListChangeListener.Change<? extendsBibEntry> c) -> {
while (c.next()) {
if (c.wasPermutated()) {
for (inti = c.getFrom(); i < c.getTo(); ++i) {
entryIndexMap.put(allEntries.get(i).getId(), i);
}
} else {
if (c.wasRemoved()) {
for (BibEntryremovedEntry : c.getRemoved()) {
entryIndexMap.remove(removedEntry.getId());
}
}
if (c.wasAdded()) {
for (inti = c.getFrom(); i < c.getTo(); ++i) {
entryIndexMap.put(allEntries.get(i).getId(), i);
}
}
}
}
});
The text was updated successfully, but these errors were encountered:
Assumption: entries are searched more often than added and removed. Then, it is "faster" to update indexes on entry addition/removed than "huge" search effort.
Currently, binarySearch is used. Which also should be fast for larger databases. If not, this issue provides a hint how to fix.
We tried with a first approach, but the indexes are not updated out of the list.
The text was updated successfully, but these errors were encountered: