UsageNode (@NotNull Usage usage) { if (!(usage instanceof MergeableUsage mergeableUsage)) return null; for (UsageNode node : getUsageNodes()) { Usage original = node.getUsage(); if (original == mergeableUsage) { // search returned duplicate usage, ignore return node; } if (original instanceof MergeableUsage) { if (((MergeableUsage)original).merge(mergeableUsage)) return node; } } return null; }