|
|
|
|
|
by Felk
1910 days ago
|
|
As "better" isn't clearly defined, here are some things that some people might consider superior: - primitives or any custom value types/structs can be used. No need for boxing or method duplication for primitives.
- type information available at runtime, no need to pass 'Class<T>' parameters.
- type constraint 'new' available, which means it must have a default constructor so you can do 'new T()'. No need to use reflection or pass a constructor parameter.
- type constraint 'notnull' available
- class-scoped compiler enforced covariance and contravariance, though I think you can get similar results with java's "? extends T" and "? super T" constraints |
|