Java: how to create a generic class that requires a data type that extends the class and implements the interface?

I want to create a composite in GWT that requires a class that extends the class and implements the interface. Psudo code as below (it does not work):

class GridRow<T extends Widget implements HasText> extends Composite{ //more codes here } 
+4
source share
1 answer

It is written as:

 class GridRow<T extends Widget & HasText> extends Composite { // ... } 

You may have [class or interface]( & [interface])* (in pseudo mode).

+13
source

Source: https://habr.com/ru/post/1436890/


All Articles