Article:
  Generic Types, Part 1
Subject:   unchecked warnings
Date:   2005-06-15 23:06:22
From:   Lahiru
"public static void printList(PrintWriter out, List list) {
for(int i=0, n=list.size(); i < n; i++) {
if (i > 0) out.print(", ");
out.print(list.get(i).toString());
}
}

In Java 5.0, List is a generic type, and, if we try to compile this method, we'll get unchecked warnings."


Why the compiler should raise unchecked warnings? Since this piece of code only has a get() method and objects are safely in the list.