private void populateVirtualP2Values( P2TypeSpecificConfigModel model, VirtualRepoDescriptor descriptor) { if (descriptor.getP2() == null || descriptor.getP2().getUrls() == null) { return; } Map<String, String> urlToRepoKeyMap = getUrlToRepoKeyMapping(descriptor.getRepositories()); List<P2Repo> p2Repos = Lists.newArrayList(); descriptor .getP2() .getUrls() .stream() .forEach( url -> { if (StringUtils.startsWith(url, "local://")) { Optional.ofNullable(resolveLocalP2RepoFromUrl(url)).ifPresent(p2Repos::add); } else { urlToRepoKeyMap .keySet() .stream() .map(RepoConfigDescriptorBuilder::getUrlWithoutSubpath) .filter( p2Url -> RepoConfigDescriptorBuilder.getUrlWithoutSubpath(url).equals(p2Url)) .findAny() .ifPresent( containingUrl -> p2Repos.add(new P2Repo(null, urlToRepoKeyMap.get(containingUrl), url))); } }); model.setP2Repos(p2Repos); }