int (@NotNull List<? extends Commit> commits, @NotNull Set<CommitId> searchHashes) { int lastIndex; for (lastIndex = 0; lastIndex < commits.size(); lastIndex++) { Commit commit = commits.get(lastIndex); if (searchHashes.isEmpty()) { return lastIndex; } searchHashes.remove(commit.getId()); } if (!searchHashes.isEmpty()) { throw new VcsLogRefreshNotEnoughDataException(); } return lastIndex; }