private void index() { /* Old version, from when set was a TreeSet. // The boolean "changing" is true in the situation that an entry is about to change, // and has temporarily been removed from the entry set in this sorter. So, if we index // now, we will cause exceptions other places because one entry has been left out of // the indexed array. Simply waiting foth this to change can lead to deadlocks, // so we have no other choice than to return without indexing. if (changing) return; */ synchronized (set) { // Resort if necessary: if (changed) { Collections.sort(set, comp); changed = false; } // Create an array of IDs for quick access, since getIdAt() is called by // getValueAt() in EntryTableModel, which *has* to be efficient. int count = set.size(); idArray = new String[count]; entryArray = new BibEntry[count]; int piv = 0; for (BibEntry entry : set) { idArray[piv] = entry.getId(); entryArray[piv] = entry; piv++; } } }