public void storeDetails(@NotNull List<? extends VcsCommitMetadata> sortedDetails) {
    List<VcsCommitMetadata> newDetails = ContainerUtil.filter(sortedDetails, metadata -> !myCache.containsValue(metadata));
    if (newDetails.isEmpty()) return;
    Iterator<VcsCommitMetadata> it = new MergingIterator(mySortedDetails, newDetails);

    List<VcsCommitMetadata> result = new ArrayList<>();
    boolean isBroken = false;
    while (it.hasNext()) {
      VcsCommitMetadata detail = it.next();
      int index = getIndex(detail);
      if (index == VcsLogStorageImpl.NO_INDEX) {
        isBroken = true;
        continue; // means some error happened (and reported) earlier, nothing we can do here
      }
      if (result.size() < VcsLogData.RECENT_COMMITS_COUNT * 2) {
        result.add(detail);
        myCache.put(index, detail);
      }
      else {
        myCache.remove(index);
      }
    }
    LOG.assertTrue(result.size() == myCache.size() || isBroken,
                   result.size() + " details to store, yet " + myCache.size() + " indexes in cache.");
    mySortedDetails = result;
  }
public void storeDetails(@NotNull List<? extends VcsCommitMetadata> sortedDetails)