Angle Bracket <> in Java is used to define Generics. See https://www.geeksforgeeks.org/angle-bracket-in-java-with-examples/.
Generics mean parameterized types. The idea is to allow type (Integer, String, … etc, and user-defined types) to be a parameter to methods, classes, and interfaces. Using Generics, it is possible to create classes that work with different data types. See https://www.geeksforgeeks.org/generics-in-java/.
When to use generic methods and when to use wild-card? See: https://stackoverflow.com/questions/18176594/when-to-use-generic-methods-and-when-to-use-wild-card
(My broad understanding) Use wildcard when the type parameter is not used elsewhere; use T
when it will be used or called.
Why only wildcard support upper bound? Maybe because the super already has a name in the original implementation, though you don't know it, so it feels improper to call it a T
. But the extension may not have got a name yet, so we can call it a T
without offending it.