Commit 91fcec83 authored by Andy Wilkinson's avatar Andy Wilkinson

Merge pull request #14056 from Christoph Dreis

* gh-14056:
  Use Collections.list() where possible
parents f63a95ed d9939b00
/* /*
* 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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -23,7 +23,7 @@ import java.io.InputStream; ...@@ -23,7 +23,7 @@ import java.io.InputStream;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader; import java.net.URLClassLoader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.util.ArrayList; import java.util.Collections;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.List; import java.util.List;
import java.util.jar.JarOutputStream; import java.util.jar.JarOutputStream;
...@@ -214,13 +214,8 @@ public class RestartClassLoaderTests { ...@@ -214,13 +214,8 @@ public class RestartClassLoaderTests {
} }
private <T> List<T> toList(Enumeration<T> enumeration) { private <T> List<T> toList(Enumeration<T> enumeration) {
List<T> list = new ArrayList<T>(); return ((enumeration != null) ? Collections.list(enumeration)
if (enumeration != null) { : Collections.<T>emptyList());
while (enumeration.hasMoreElements()) {
list.add(enumeration.nextElement());
}
}
return list;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment