diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/repository/DefaultMavenRepositorySettings.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/repository/DefaultMavenRepositorySettings.java index 791132c528..891205eeaa 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/repository/DefaultMavenRepositorySettings.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/repository/DefaultMavenRepositorySettings.java @@ -14,11 +14,11 @@ package org.eclipse.tycho.p2maven.repository; import java.net.URI; -import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Stream; import org.apache.maven.artifact.repository.ArtifactRepository; import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy; @@ -161,12 +161,7 @@ public void initialize() throws InitializationException { } @Override - public Iterable getMirrors() { - List result = new ArrayList<>(); - for (Mirror mirror : mirrors) { - MavenRepositoryLocation location = new MavenRepositoryLocation(mirror.getId(), URI.create(mirror.getUrl())); - result.add(location); - } - return result; + public Stream getMirrors() { + return mirrors.stream().map(m -> new MavenRepositoryLocation(m.getId(), URI.create(m.getUrl()))); } } diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/repository/DefaultRepositoryIdManager.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/repository/DefaultRepositoryIdManager.java index cbd314aa9d..88d23cb918 100644 --- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/repository/DefaultRepositoryIdManager.java +++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/repository/DefaultRepositoryIdManager.java @@ -18,7 +18,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; -import java.util.stream.StreamSupport; import org.codehaus.plexus.component.annotations.Component; import org.codehaus.plexus.component.annotations.Requirement; @@ -120,9 +119,8 @@ private static boolean certainlyNoRemoteURL(URI location) { @Override public Stream getKnownMavenRepositoryLocations() { // Returns both repository and mirror locations - return Stream.concat( - knownMavenRepositoryIds.entrySet().stream().map(e -> new MavenRepositoryLocation(e.getValue(), e.getKey())), - StreamSupport.stream(settings.getMirrors().spliterator(), false)); + return Stream.concat(knownMavenRepositoryIds.entrySet().stream() + .map(e -> new MavenRepositoryLocation(e.getValue(), e.getKey())), settings.getMirrors()); } @Override diff --git a/tycho-api/src/main/java/org/eclipse/tycho/MavenRepositorySettings.java b/tycho-api/src/main/java/org/eclipse/tycho/MavenRepositorySettings.java index cd88dff79b..a2f3a8c10a 100644 --- a/tycho-api/src/main/java/org/eclipse/tycho/MavenRepositorySettings.java +++ b/tycho-api/src/main/java/org/eclipse/tycho/MavenRepositorySettings.java @@ -14,6 +14,7 @@ package org.eclipse.tycho; import java.net.URI; +import java.util.stream.Stream; /** * Provides the mirror configuration and credentials from the Maven settings for loading remote p2 @@ -63,6 +64,6 @@ public String toString() { /** * Returns all configured mirror locations. */ - Iterable getMirrors(); + Stream getMirrors(); }