Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Self bounded generics

Tags:

java

generics

Is there is any actual difference between these this generic

public class SelfBounded <T extends SelfBounded<T>>{}

and this one

public class SelfBounded <T extends SelfBounded>{}  

?

If yes, then how can I observe them?

like image 784
Iza Marek Avatar asked Oct 25 '13 11:10

Iza Marek


1 Answers

There are a lot of similar questions here already. You can read the following article

Or the following questions:

  • Java Enum definition
  • Why in java enum is declared as Enum<E extends Enum<E>>
  • What would be different in Java if Enum declaration didn't have the recursive part
like image 143
masarov Avatar answered Oct 31 '22 21:10

masarov