class NamespaceMappingRequest {

    public List<Result<JcrNs>> resolveToJcrNs(final @NotNull NamespaceMapping mapping) {
        final List<Result<JcrNs>> results = new ArrayList<>();

        retainPrefixes.stream()
                .map(result1(prefix -> JcrNs.create(prefix, mapping.getURI(prefix))))
                .forEach(results::add);

        final Set<String> retainedUris = results.stream().flatMap(Result::stream).map(JcrNs::getUri)
                .collect(Collectors.toSet());

        retainUris.stream()
                .filter(inSet(retainedUris).negate())
                .map(result1(uri -> JcrNs.create(mapping.getPrefix(uri), uri)))
                .forEach(results::add);

        return results;
    }

    private  NamespaceMappingRequest(final @NotNull Set<String> retainPrefixes,
                                    final @NotNull Set<String> retainUris,
                                    final boolean retainBuiltins);

}