List of Classes implementing an Interface

前端 未结 2 1320
没有蜡笔的小新
没有蜡笔的小新 2021-02-15 14:55

Is there a way to implement something like

    List> ClassList = new ArrayList

        
2条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-15 15:13

    List> ClassList = new ArrayList>(); 
    

    should be

    List> ClassList = new ArrayList>(); 
    

    there is no implements keyword in the world of generics. if you want a type parameter that implements an interface , use the extends keyword to represent it.

提交回复
热议问题