Set<Commit> (@NotNull List<? extends Commit> unsafeGreenPartSavedLog, @NotNull List<? extends Commit> firstBlock) { Set<CommitId> existedCommitHashes = new HashSet<>(); for (Commit commit : unsafeGreenPartSavedLog) { existedCommitHashes.add(commit.getId()); } Set<Commit> allNewsCommits = new HashSet<>(); for (Commit newCommit : firstBlock) { if (!existedCommitHashes.contains(newCommit.getId())) { allNewsCommits.add(newCommit); } } return allNewsCommits; }