生成项目后,字节码(.class文件)应如下所示:
public abstract class FooList implements List<Foo>
,所以这是一个简单的foo列表。
小心使用这种方法,使用您的傻瓜和简单的列表来查看这种代码:
公共类主{
public static void main(String[] args) {
//works
List<Foo> foos = new ArrayList<>();
//don't work
FooList fooList = new ArrayList<>();
FooList fooList2 = new ArrayList();
//work, but not necessary
FooList fooList3 = new FooList() {
//implement all method from List interface
};
}