1
0

Use generics

This commit is contained in:
Gary Gregory
2024-06-30 08:34:23 -04:00
parent ab4b5c50d8
commit d6ae2efb64

View File

@@ -95,13 +95,13 @@ public class ChildFirstTestCase extends TestCase {
/** /**
* Utility method to convert an enumeration-of-URLs into an array of URLs. * Utility method to convert an enumeration-of-URLs into an array of URLs.
*/ */
private static URL[] toURLArray(final Enumeration e) { private static URL[] toURLArray(final Enumeration<URL> e) {
final ArrayList l = new ArrayList(); final ArrayList<URL> l = new ArrayList<>();
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
l.add((URL) e.nextElement()); l.add(e.nextElement());
} }
final URL[] tmp = new URL[l.size()]; final URL[] tmp = new URL[l.size()];
return (URL[]) l.toArray(tmp); return l.toArray(tmp);
} }
/** /**
@@ -266,7 +266,7 @@ public class ChildFirstTestCase extends TestCase {
* Test that the various flavors of ClassLoader.getResources work as expected. * Test that the various flavors of ClassLoader.getResources work as expected.
*/ */
public void testResources() throws Exception { public void testResources() throws Exception {
Enumeration resources; Enumeration<URL> resources;
URL[] urls; URL[] urls;
// verify the class loader hierarchy // verify the class loader hierarchy