RepositoryNode (@Nullable final Repository repository) { if (repository == null) return null; Map.Entry<RepositoryNode, MyRepoModel<Repository, PushSource, PushTarget>> entry = ContainerUtil.find(myView2Model.entrySet(), entry1 -> { MyRepoModel<?, ?, ?> model = entry1.getValue(); return model.getRepository().getRoot().equals(repository.getRoot()); }); return entry != null ? entry.getKey() : null; }