From d9939b00e2c2fc873fbdac9d5851aea108ec3e55 Mon Sep 17 00:00:00 2001 From: dreis2211 Date: Tue, 14 Aug 2018 12:58:24 +0200 Subject: [PATCH] Use Collections.list() where possible Closes gh-14056 --- .../classloader/RestartClassLoaderTests.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java index 1ad2954ac4..8f06263182 100644 --- a/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java +++ b/spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import java.io.InputStream; import java.net.URL; import java.net.URLClassLoader; import java.nio.charset.Charset; -import java.util.ArrayList; +import java.util.Collections; import java.util.Enumeration; import java.util.List; import java.util.jar.JarOutputStream; @@ -214,13 +214,8 @@ public class RestartClassLoaderTests { } private List toList(Enumeration enumeration) { - List list = new ArrayList(); - if (enumeration != null) { - while (enumeration.hasMoreElements()) { - list.add(enumeration.nextElement()); - } - } - return list; + return ((enumeration != null) ? Collections.list(enumeration) + : Collections.emptyList()); } }