比如 B< List<T> > : public A<T>class A <P, C> {
  P getParent();
  C[] getChilds();
}class B<P extends (自己), C> : public <P, C> {
}当然可以 extends B ,不加泛型参数,没有更好的方法么?
随便问句,带泛型参数的Collection类没办法直接实例化数组么?
如 Map<K,V> p[] = new HashMap<K,V>[]?

解决方案 »

  1.   

    比如  
      List <String > list=new ArrayList<String>();
      这个就是创建列表数组的String类型的
      

  2.   


    应该是JAVA的吧。。楼主说呢
      

  3.   


    当然是JAVA的class A<T> {
    }限定T必须是A的继承类class A<T extends A<?> > {
    }是这样么?
      

  4.   

    随便问句,带泛型参数的Collection类没办法直接实例化数组么? 
    如 Map<K,V> p[] = new HashMap<K,V>[]?————————————————————————————————————————由于类型安全原因,不允许声明泛型数组,但可以这样:Map<String, String>[] map = new Map[5];
    for(int i = 0; i < map.length; i++) {
        map[i] = new HashMap<String, String>();
    }
      

  5.   

    详见 Generics in the Java Programming Language 7.3 节(第 15 页)。http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf