Esempio n. 1
0
 /**
  * Goes through all entries in the given database, and if at least one of them is a duplicate of
  * the given entry, as per Util.isDuplicate(BibEntry, BibEntry), the duplicate is returned. The
  * search is terminated when the first duplicate is found.
  *
  * @param database The database to search.
  * @param entry The entry of which we are looking for duplicates.
  * @return The first duplicate entry found. null if no duplicates are found.
  */
 public static Optional<BibEntry> containsDuplicate(
     BibDatabase database, BibEntry entry, BibDatabaseMode bibDatabaseMode) {
   for (BibEntry other : database.getEntries()) {
     if (DuplicateCheck.isDuplicate(entry, other, bibDatabaseMode)) {
       return Optional.of(other); // Duplicate found.
     }
   }
   return Optional.empty(); // No duplicate found.
 }