コード例 #1
0
 /** Adds the duplicate entries to the ListViews on the interface. */
 private final void addDuplicateEntries() {
   final ArrayList<DuplicateMovieEntry> entries = new ArrayList<>();
   for (MovieDefinition key : duplicateEntries.keySet()) {
     final MovieDefinition definition =
         MediaManager.getMediaRepository().getLoadedMovieDefinitions().get(key);
     final ArrayList<MovieEntry> list = duplicateEntries.get(key);
     entries.add(new DuplicateMovieEntry(definition, list));
   }
   Collections.sort(
       entries,
       (a, b) -> {
         final String str1 = a.getDefinition().getTitle().toLowerCase();
         final String str2 = b.getDefinition().getTitle().toLowerCase();
         return str1.compareTo(str2);
       });
   duplicateEntries.clear();
   duplicateListView.getItems().clear();
   movieTitleListView.getItems().setAll(entries);
 }
コード例 #2
0
 private final void findDuplicates() {
   for (MovieEntry e : MediaManager.getMediaRepository().getLoadedMovieEntries()) {
     Optional<MovieDefinition> definition = e.getDefinition();
     definition.ifPresent(def -> addDuplicate(e, def));
   }
 }