From 0a1009bc421268d797d2b153733bf12667c78eff Mon Sep 17 00:00:00 2001 From: Oscar Utbult Date: Wed, 30 Nov 2016 23:49:34 +0100 Subject: [PATCH] Use addAll instead of manual array to collection copy Closes gh-7539 --- .../boot/devtools/restart/server/RestartServer.java | 5 ++--- .../ConfigurationWarningsApplicationContextInitializer.java | 4 +--- 2 files changed, 3 insertions(+), 6 deletions(-) mode change 100644 => 100755 spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java mode change 100644 => 100755 spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java diff --git a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java old mode 100644 new mode 100755 index 3d5244200e..49dcf3db61 --- a/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java +++ b/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/server/RestartServer.java @@ -20,6 +20,7 @@ import java.io.File; import java.io.IOException; import java.net.URL; import java.net.URLClassLoader; +import java.util.Collections; import java.util.LinkedHashSet; import java.util.Map.Entry; import java.util.Set; @@ -141,9 +142,7 @@ public class RestartServer { ClassLoader classLoader = this.classLoader; while (classLoader != null) { if (classLoader instanceof URLClassLoader) { - for (URL url : ((URLClassLoader) classLoader).getURLs()) { - urls.add(url); - } + Collections.addAll(urls, ((URLClassLoader) classLoader).getURLs()); } classLoader = classLoader.getParent(); } diff --git a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java old mode 100644 new mode 100755 index 37122198d6..bc61b1f561 --- a/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java +++ b/spring-boot/src/main/java/org/springframework/boot/context/ConfigurationWarningsApplicationContextInitializer.java @@ -183,9 +183,7 @@ public class ConfigurationWarningsApplicationContextInitializer private void addPackages(Set packages, String[] values) { if (values != null) { - for (String value : values) { - packages.add(value); - } + Collections.addAll(packages, values); } }