Source:
<code>protected QueryBuilder getFilterForHasAuthorizationContainer(HasAuthorizationContainer hasAuthorization) { PropertyNameVisibilitiesStore visibilitiesStore = getSearchIndex().getPropertyNameVisibilitiesStore(); Authorizations auths = getParameters().getAuthorizations(); Graph graph = getGraph(); <START> Set<String> hashes = StreamSupport.stream(hasAuthorization.getAuthorizations().spliterator(), false) <END> .flatMap(authorization -> visibilitiesStore.getHashesWithAuthorization(graph, authorization, auths).stream()) .collect(Collectors.toSet()); List<QueryBuilder> filters = new ArrayList<>(); for (PropertyDefinition propertyDefinition : graph.getPropertyDefinitions()) { String propertyName = propertyDefinition.getPropertyName(); Set<String> matchingPropertyHashes = visibilitiesStore.getHashes(graph, propertyName, auths).stream() .filter(hashes::contains) .collect(Collectors.toSet()); for (String fieldName : getSearchIndex().addHashesToPropertyName(propertyName, matchingPropertyHashes)) { filters.add(QueryBuilders.existsQuery(fieldName.replace(".", FIELDNAME_DOT_REPLACEMENT))); } } Collection<String> elementTypeHashes = visibilitiesStore.getHashes(graph, Elasticsearch5SearchIndex.ELEMENT_TYPE_FIELD_NAME, auths); Collection<String> matchingElementTypeHashes = elementTypeHashes.stream().filter(hashes::contains).collect(Collectors.toSet()); for (String elementTypeFieldName : getSearchIndex().addHashesToPropertyName(Elasticsearch5SearchIndex.ELEMENT_TYPE_FIELD_NAME, matchingElementTypeHashes)) { filters.add(QueryBuilders.existsQuery(elementTypeFieldName)); } if (filters.isEmpty()) { throw new VertexiumNoMatchingPropertiesException(Joiner.on(", ").join(hasAuthorization.getAuthorizations())); } return getSingleFilterOrOrTheFilters(filters, hasAuthorization); }</code><technical_language>StreamUtils.stream (it's a Vertexium class)</technical_language>

Target:
protected QueryBuilder getFilterForHasAuthorizationContainer(HasAuthorizationContainer hasAuthorization) { PropertyNameVisibilitiesStore visibilitiesStore = getSearchIndex().getPropertyNameVisibilitiesStore(); Authorizations auths = getParameters().getAuthorizations(); Graph graph = getGraph(); Set<String> hashes = StreamUtils.stream(hasAuthorization.getAuthorizations()) .flatMap(authorization -> visibilitiesStore.getHashesWithAuthorization(graph, authorization, auths).stream()) .collect(Collectors.toSet()); List<QueryBuilder> filters = new ArrayList<>(); for (PropertyDefinition propertyDefinition : graph.getPropertyDefinitions()) { String propertyName = propertyDefinition.getPropertyName(); Set<String> matchingPropertyHashes = visibilitiesStore.getHashes(graph, propertyName, auths).stream() .filter(hashes::contains) .collect(Collectors.toSet()); for (String fieldName : getSearchIndex().addHashesToPropertyName(propertyName, matchingPropertyHashes)) { filters.add(QueryBuilders.existsQuery(getSearchIndex().replaceFieldnameDots(fieldName))); } } Collection<String> elementTypeHashes = visibilitiesStore.getHashes(graph, Elasticsearch5SearchIndex.ELEMENT_TYPE_FIELD_NAME, auths); Collection<String> matchingElementTypeHashes = elementTypeHashes.stream().filter(hashes::contains).collect(Collectors.toSet()); for (String elementTypeFieldName : getSearchIndex().addHashesToPropertyName(Elasticsearch5SearchIndex.ELEMENT_TYPE_FIELD_NAME, matchingElementTypeHashes)) { filters.add(QueryBuilders.existsQuery(elementTypeFieldName)); } if (filters.isEmpty()) { throw new VertexiumNoMatchingPropertiesException(Joiner.on(", ").join(hasAuthorization.getAuthorizations())); } return getSingleFilterOrOrTheFilters(filters, hasAuthorization); }