編譯代碼才能使用-Xlint我發現這一點:對象ArrayList的<String>選中投
warning: [unchecked] unchecked cast
found : java.lang.Object
required: java.util.ArrayList<java.lang.String>
ArrayList<String> msgData = (ArrayList<String>)element;
這是代碼:
ArrayList<ArrayList<String>> msg = new ArrayList<ArrayList<String>>();
//add some data to msg
Iterator i = msg.iterator();
while(i.hasNext()) {
Object element = i.next();
ArrayList<String> msgData = (ArrayList<String>)element;
}
應該如何投做些什麼呢?