boolean (@NotNull final String name, boolean shared) { final boolean hasName = myProfilePanels.stream().map(SingleInspectionProfilePanel::getProfile).anyMatch(p -> name.equals(p.getName()) && p.isProjectLevel() == shared); if (hasName) return true; return myProfilePanels.stream().anyMatch(p -> { final InspectionProfileModifiableModel profile = p.getProfile(); return name.equals(profile.getName()) && profile.isProjectLevel() == shared; }); }