Skip to content

Commit d9939b0

Browse files
dreis2211wilkinsona
authored andcommitted
Use Collections.list() where possible
Closes gh-14056
1 parent f63a95e commit d9939b0

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

spring-boot-devtools/src/test/java/org/springframework/boot/devtools/restart/classloader/RestartClassLoaderTests.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@
2323
import java.net.URL;
2424
import java.net.URLClassLoader;
2525
import java.nio.charset.Charset;
26-
import java.util.ArrayList;
26+
import java.util.Collections;
2727
import java.util.Enumeration;
2828
import java.util.List;
2929
import java.util.jar.JarOutputStream;
@@ -214,13 +214,8 @@ private String readString(InputStream in) throws IOException {
214214
}
215215

216216
private <T> List<T> toList(Enumeration<T> enumeration) {
217-
List<T> list = new ArrayList<T>();
218-
if (enumeration != null) {
219-
while (enumeration.hasMoreElements()) {
220-
list.add(enumeration.nextElement());
221-
}
222-
}
223-
return list;
217+
return ((enumeration != null) ? Collections.list(enumeration)
218+
: Collections.<T>emptyList());
224219
}
225220

226221
}

0 commit comments

Comments
 (0)