void (Set<FileTypeWithDescriptor> descriptors) { ConcurrentHashMap<String, FileTypeWithDescriptor> names = new ConcurrentHashMap<>(); ConcurrentHashMap<String, FileTypeWithDescriptor> displayNames = new ConcurrentHashMap<>(); ConcurrentHashMap<String, FileTypeWithDescriptor> descriptions = new ConcurrentHashMap<>(); for (FileTypeWithDescriptor descriptor : descriptors) { checkUnique(descriptor, names, "getName", FileType::getName); checkUnique(descriptor, displayNames, "getDisplayName", FileType::getDisplayName); checkUnique(descriptor, descriptions, "getDescription", FileType::getDescription); } }