1
0

Use generics

This commit is contained in:
Gary Gregory
2024-06-30 10:44:40 -04:00
parent 41621417cb
commit 50bc992aaf

View File

@@ -94,14 +94,13 @@ public class ParentFirstTestCase 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()) {
final URL u = (URL) e.nextElement(); l.add(e.nextElement());
l.add(u);
} }
final URL[] tmp = new URL[l.size()]; final URL[] tmp = new URL[l.size()];
return (URL[]) l.toArray(tmp); return l.toArray(tmp);
} }
/** /**
@@ -109,8 +108,8 @@ public class ParentFirstTestCase extends TestCase {
* parent chain starting from the one that loaded the class for * parent chain starting from the one that loaded the class for
* this object instance. * this object instance.
*/ */
private Set getAncestorCLs() { private Set<ClassLoader> getAncestorCLs() {
final Set s = new HashSet(); final Set<ClassLoader> s = new HashSet<>();
ClassLoader cl = this.getClass().getClassLoader(); ClassLoader cl = this.getClass().getClassLoader();
while (cl != null) { while (cl != null) {
s.add(cl); s.add(cl);