Source:
<code>private Map<String, List<String>> getAgentRoles(final FedoraResource resource) { LOGGER.debug("Getting agent roles for: {}", resource.getPath()); final Optional<ACLHandle> effectiveAcl = getEffectiveAcl( isNonRdfSourceDescription.test(resource.getNode()) ? ((NonRdfSourceDescription)nodeConverter.convert(resource.getNode())).getDescribedResource() : resource); final List<String> resourcePaths = new ArrayList<>(); resourcePaths.add(FEDORA_INTERNAL_PREFIX + resource.getPath()); final List<URI> rdfTypes = resource.getTypes(); effectiveAcl .map(aclHandle -> aclHandle.resource) .filter(effectiveResource -> !effectiveResource.getPath().equals(resource.getPath())) .ifPresent(effectiveResource -> { resourcePaths.add(FEDORA_INTERNAL_PREFIX + effectiveResource.getPath()); rdfTypes.addAll(effectiveResource.getTypes()); }); if (!effectiveAcl.isPresent()) { resourcePaths.addAll(getAllPathAncestors(resource.getPath())); } final Predicate<WebACAuthorization> checkAccessTo = accessTo.apply(resourcePaths); final Predicate<WebACAuthorization> checkAccessToClass = accessToClass.apply(rdfTypes.stream().map(URI::toString).collect(toList())); final List<WebACAuthorization> authorizations = effectiveAcl .map(auth -> getAuthorizations(auth.uri.toString())) .orElseGet(() -> getDefaultAuthorizations()); final Map<String, Set<String>> effectiveRoles = new HashMap<>(); authorizations.stream() .filter(checkAccessTo.or(checkAccessToClass)) .forEach(auth -> { concat(auth.getAgents().stream(), dereferenceAgentClasses(auth.getAgentClasses()).stream()) .forEach(agent -> { effectiveRoles.putIfAbsent(agent, new HashSet<>()); effectiveRoles.get(agent).addAll(auth.getModes().stream().map(URI::toString).collect(toSet())); }); }); LOGGER.debug("Unfiltered ACL: {}", effectiveRoles); return effectiveRoles.entrySet().stream() <START> .map(roleSet -> new AbstractMap.SimpleEntry<>(roleSet.getKey(), new ArrayList<>(roleSet.getValue()))) <END> .collect(toMap(Map.Entry::getKey, Map.Entry::getValue)); }</code><technical_language>is a List needed here</technical_language>

Target:
private Map<String, List<String>> getAgentRoles(final FedoraResource resource) { LOGGER.debug("Getting agent roles for: {}", resource.getPath()); final Optional<ACLHandle> effectiveAcl = getEffectiveAcl( isNonRdfSourceDescription.test(resource.getNode()) ? ((NonRdfSourceDescription)nodeConverter.convert(resource.getNode())).getDescribedResource() : resource); final List<String> resourcePaths = new ArrayList<>(); resourcePaths.add(FEDORA_INTERNAL_PREFIX + resource.getPath()); final List<URI> rdfTypes = resource.getTypes(); effectiveAcl .map(aclHandle -> aclHandle.resource) .filter(effectiveResource -> !effectiveResource.getPath().equals(resource.getPath())) .ifPresent(effectiveResource -> { resourcePaths.add(FEDORA_INTERNAL_PREFIX + effectiveResource.getPath()); rdfTypes.addAll(effectiveResource.getTypes()); }); if (!effectiveAcl.isPresent()) { resourcePaths.addAll(getAllPathAncestors(resource.getPath())); } final Predicate<WebACAuthorization> checkAccessTo = accessTo.apply(resourcePaths); final Predicate<WebACAuthorization> checkAccessToClass = accessToClass.apply(rdfTypes.stream().map(URI::toString).collect(toList())); final List<WebACAuthorization> authorizations = effectiveAcl .map(auth -> getAuthorizations(auth.uri.toString())) .orElseGet(() -> getDefaultAuthorizations()); final Map<String, Set<String>> effectiveRoles = new HashMap<>(); authorizations.stream() .filter(checkAccessTo.or(checkAccessToClass)) .forEach(auth -> { concat(auth.getAgents().stream(), dereferenceAgentClasses(auth.getAgentClasses()).stream()) .forEach(agent -> { effectiveRoles.computeIfAbsent(agent, key -> new HashSet<>()) .addAll(auth.getModes().stream().map(URI::toString).collect(toSet())); }); }); LOGGER.debug("Unfiltered ACL: {}", effectiveRoles); return transformValues(effectiveRoles, ArrayList::new); }