private static <T extends PsiNamedElement> T findByName(@NotNull String name, @NotNull List<T> namedElements) {
    for (T namedElement : namedElements) {
      if (name.equals(namedElement.getName())) {
        return namedElement;
      }
    }
    return null;
  }
private static <T extends PsiNamedElement> T findByName(@NotNull String name, @NotNull List<T> namedElements)