langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
changeset 1789 7ac8c0815000
parent 1264 076a3cde30d5
child 1864 c17be9084212
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Thu Jan 08 16:34:58 2009 -0800
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue Jan 13 13:27:14 2009 +0000
@@ -88,10 +88,10 @@
     /**
      * Return the list of ProgramElementDoc objects as Array.
      */
-    public static ProgramElementDoc[] toProgramElementDocArray(List list) {
+    public static ProgramElementDoc[] toProgramElementDocArray(List<ProgramElementDoc> list) {
         ProgramElementDoc[] pgmarr = new ProgramElementDoc[list.size()];
         for (int i = 0; i < list.size(); i++) {
-            pgmarr[i] = (ProgramElementDoc)(list.get(i));
+            pgmarr[i] = list.get(i);
         }
         return pgmarr;
     }
@@ -416,9 +416,9 @@
                 continue;
             }
             results.put(interfaceClassDoc, interfaceType);
-            List superInterfaces = getAllInterfaces(interfaceType, configuration, sort);
-            for (Iterator iter = superInterfaces.iterator(); iter.hasNext(); ) {
-                Type t = (Type) iter.next();
+            List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration, sort);
+            for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) {
+                Type t = iter.next();
                 results.put(t.asClassDoc(), t);
             }
         }
@@ -438,7 +438,7 @@
         return resultsList;
     }
 
-    public static List getAllInterfaces(Type type, Configuration configuration) {
+    public static List<Type> getAllInterfaces(Type type, Configuration configuration) {
         return getAllInterfaces(type, configuration, true);
     }
 
@@ -480,9 +480,9 @@
             if (raw)
                 interfaceType = interfaceType.asClassDoc();
             results.put(interfaceClassDoc, interfaceType);
-            List superInterfaces = getAllInterfaces(interfaceType, configuration);
-            for (Iterator iter = superInterfaces.iterator(); iter.hasNext(); ) {
-                Type superInterface = (Type) iter.next();
+            List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration);
+            for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) {
+                Type superInterface = iter.next();
                 results.put(superInterface.asClassDoc(), superInterface);
             }
         }
@@ -495,8 +495,8 @@
     }
 
 
-    public static List<ProgramElementDoc> asList(ProgramElementDoc[] members) {
-        List<ProgramElementDoc> list = new ArrayList<ProgramElementDoc>();
+    public static <T extends ProgramElementDoc> List<T> asList(T[] members) {
+        List<T> list = new ArrayList<T>();
         for (int i = 0; i < members.length; i++) {
             list.add(members[i]);
         }