void (final T selectedOccurrence, final List<T> allOccurrences, final Pass<? super ReplaceChoice> callback) { if (allOccurrences.size() == 1) { try (AccessToken ignore = SlowOperations.startSection(SlowOperations.ACTION_PERFORM)) { callback.accept(ReplaceChoice.ALL); } } else { Map<ReplaceChoice, List<T>> occurrencesMap = new LinkedHashMap<>(); occurrencesMap.put(ReplaceChoice.NO, Collections.singletonList(selectedOccurrence)); occurrencesMap.put(ReplaceChoice.ALL, allOccurrences); showChooser(occurrencesMap, callback); } }