public void clearItems() {
   synchronized (lock) {
     myItems.clear();
     mySortedItems.clear();
     myRelevanceClassifier = myArranger.createRelevanceClassifier();
   }
 }
  public void addItem(LookupElement item) {
    synchronized (lock) {
      myRelevanceClassifier.addElement(item);
      mySortedItems.add(
          item); // ProcessCanceledException may occur in these two lines, then this element is
      // considered not added

      myItems.add(item);
      stamp++;
    }
  }