Source:
<code><START> public WriteResponse updateExplicitEquivalence(HttpServletRequest req, HttpServletResponse resp) { <END> PossibleApplication possibleApplication = validateApplicationConfiguration(req, resp); if (possibleApplication.getErrorSummary().isPresent()) { return error(req, resp, possibleApplication.getErrorSummary().get()); } String uri = req.getParameter(URI); ResolvedContent resolvedContent = contentResolver.findByCanonicalUris(Lists.newArrayList(uri)); @SuppressWarnings("deprecation") Maybe<Identified> identified; if (!resolvedContent.isEmpty()) { identified = resolvedContent.getFirstValue(); } else { return error(req, resp, AtlasErrorSummary.forException( new NoSuchElementException("could not resolve content for URI") )); } if (!identified.hasValue()) { return error(req, resp, AtlasErrorSummary.forException( new NoSuchElementException("Unable to resolve content"))); } Content content = (Content) identified.requireValue(); Optional<AtlasErrorSummary> apiKeyErrorSummary = validateApiKey( req, resp, content.getPublisher(), possibleApplication.getApplication() ); if (apiKeyErrorSummary.isPresent()) { return error(req, resp, apiKeyErrorSummary.get()); } Iterable<LookupEntry> explicitEquivLookupEntries = lookupEntryStore.entriesForCanonicalUris( COMMA_SPLITTER.splitToList(req.getParameter(EXPLICIT)) ); ImmutableSet<LookupRef> explicitEquivLookupRefs = MoreStreams.stream(explicitEquivLookupEntries) .map(LookupEntry::lookupRef) .collect(MoreCollectors.toImmutableSet()); writeExecutor.updateExplicitEquivalence(content, explicitEquivLookupRefs); resp.setStatus(HttpServletResponse.SC_OK); return new WriteResponse(encodeId(content.getId())); }</code><technical_language>feels of this code a duplicate of something</technical_language>

Target:
public WriteResponse updateExplicitEquivalence(HttpServletRequest req, HttpServletResponse resp) { PossibleApplication possibleApplication = validateApplicationConfiguration(req, resp); if (possibleApplication.getErrorSummary().isPresent()) { return error(req, resp, possibleApplication.getErrorSummary().get()); } String uri = req.getParameter(URI); if(Strings.isNullOrEmpty(uri) || req.getParameter(EXPLICIT) == null) { return error( req, resp, AtlasErrorSummary.forException(new BadRequestException( String.format("'%s' / '%s' not specified", URI, EXPLICIT) )) ); } ResolvedContent resolvedContent = contentResolver.findByCanonicalUris(Lists.newArrayList(uri)); @SuppressWarnings("deprecation") Maybe<Identified> identified; if (!resolvedContent.isEmpty()) { identified = resolvedContent.getFirstValue(); } else { return error(req, resp, AtlasErrorSummary.forException( new NoSuchElementException("could not resolve content for URI") )); } if (!identified.hasValue()) { return error(req, resp, AtlasErrorSummary.forException( new NoSuchElementException("Unable to resolve content"))); } Content content = (Content) identified.requireValue(); Optional<AtlasErrorSummary> apiKeyErrorSummary = validateApiKey( req, resp, content.getPublisher(), possibleApplication.getApplication() ); if (apiKeyErrorSummary.isPresent()) { return error(req, resp, apiKeyErrorSummary.get()); } Iterable<LookupEntry> explicitEquivLookupEntries = lookupEntryStore.entriesForCanonicalUris( COMMA_SPLITTER.splitToList(req.getParameter(EXPLICIT)) ); ImmutableSet<LookupRef> explicitEquivLookupRefs = MoreStreams.stream(explicitEquivLookupEntries) .map(LookupEntry::lookupRef) .collect(MoreCollectors.toImmutableSet()); writeExecutor.updateExplicitEquivalence(content, explicitEquivLookupRefs); resp.setStatus(HttpServletResponse.SC_OK); return new WriteResponse(encodeId(content.getId())); }