public static Optional<NameID> getNameId(Response response, Predicate<NameID> filter) {
        return response.getAssertions().stream()
                       .map(s -> s.getSubject().getNameID())
                       .filter(filter)
                       .findFirst();
    }
public static Optional < NameID > getNameId ( Response response , Predicate < NameID > filter ) { return response . getAssertions ( ) . stream ( ) . map ( s -> s . getSubject ( ) . getNameID ( ) ) . filter ( filter ) . findFirst ( ) ; }
Returns a {@link NameID} which is matched to the specified {@code filter} from the {@link Response}.