With non-generic collections, a cast is required:
import java.util.ArrayList;
import java.util.List;
public class MainClass{
public static void main(String[] argv){
List<String> gList = new ArrayList<String>();
List list = new ArrayList();
// more code
String s = gList.get(0); // no cast needed
s = (String)list.get(0); // cast required
}
}
|