void (@NotNull YAMLMapping mapping) { MultiMap<String, YAMLKeyValue> occurrences = new MultiMap<>(); for (YAMLKeyValue keyValue : mapping.getKeyValues()) { final String keyName = keyValue.getKeyText().trim(); // http://yaml.org/type/merge.html if (keyName.equals("<<")) { continue; } if (!keyName.isEmpty()) { occurrences.putValue(keyName, keyValue); } } for (Map.Entry<String, Collection<YAMLKeyValue>> entry : occurrences.entrySet()) { if (entry.getValue().size() > 1) { entry.getValue().forEach((duplicatedKey) -> { assert duplicatedKey.getKey() != null; assert duplicatedKey.getParentMapping() != null : "This key is gotten from mapping"; holder.registerProblem(duplicatedKey.getKey(), YAMLBundle.message("YAMLDuplicatedKeysInspection.duplicated.key", entry.getKey()), ProblemHighlightType.GENERIC_ERROR_OR_WARNING, new RemoveDuplicatedKeyQuickFix()); }); } } }