Java泛型编程最全总结
由于发到iteye上面格式乱了,需要的朋友可以下载附件。
?
List<?>[] lsa = new List<?>[10]; // ok, array of unbounded wildcard typeObject o = lsa;Object[] oa = (Object[]) o;List<Integer>li = new ArrayList<Integer>();li.add(new Integer(3));oa[1] = li; //correctString s = (String) lsa[1].get(0);// run time error, but cast is explicitInteger it = (Integer)lsa[1].get(0); // OK?
??
参考资料:
http://www.aqee.net/java-generics-quick-tutorial/
http://www.infoq.com/cn/articles/cf-java-generics
http://blog.csdn.net/daniel_h1986/article/details/5708605
http://www.cnblogs.com/stephen-liu74/archive/2012/01/20/2228938.html
sun官方文档:generics-tutorial.pdf
?
?