Generic Type

Generic Type

近日,碰到类似于“ ...raw type list..”字样的提示,研究发现,J2SE 5.0有了一个新的变化,就是generic概念,详细请看:
http://java.sun.com/docs/books/tutorial/java/javaOO/gentypes.html

问题自然就会得到答案。

提供一例:
假设你要建立一类Product的arraylist,代码应为:
List < Product >  result = new ArrayList < Product > ();
result.add(new Product());
以前的写法为:
List result = new ArrayList();
result.add(new Product());
其中奥妙看那篇文章吧。:)

你可能感兴趣的:(Generic Type)