void (final Project project, final List<? extends VirtualFile> images, Map<Long, Set<VirtualFile>> duplicates) { final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); if (indicator == null || indicator.isCanceled()) return; indicator.setText("MD5 check"); int count = duplicates.values().stream().mapToInt(Set::size).sum(); final Map<String, Set<VirtualFile>> realDuplicates = new HashMap<>(); int seek = 0; for (Set<VirtualFile> files : duplicates.values()) { for (VirtualFile file : files) { seek++; indicator.setFraction((double)seek / (double)count); try { ReadAction.run(() -> { final String md5 = getMD5Checksum(file); realDuplicates.computeIfAbsent(md5, k -> new HashSet<>()).add(file); }); } catch (Exception ignored) { } } } count = 0; for (String key : new ArrayList<>(realDuplicates.keySet())) { final int size = realDuplicates.get(key).size(); if (size == 1) { realDuplicates.remove(key); } else { count += size; } } ApplicationManager.getApplication().invokeLater(() -> new ImageDuplicateResultsDialog(project, images, realDuplicates).show()); }