8 Replies
No thanks
Already had enough cringe trying to instantiate an array of a generic type for my generic array list class
Peter Verhas
JAXenter
The new ValueType in Java: Why value types are important
Java, as it is now, has two different types of data—primitives and objects. In the coming releases, there will be a new type that is called ValueType.
If Java is better at one thing, that is generics.
Fuck
new T[size]
, all my homies use (T[])new Object[size]
and ignore the warning
I mean
what the fuck
Why?you know the
ClassA<? super T>
that is not possible in C#
you can't imply a base class with generics in C#
and that can be very usefull
for example (from JavaFX):
Also: In Java you can have instances of generic classes without specifing a generic typeI still dont get why you'd wanna do that
Pretty sure that's just because they wanted to give legacy support to pre-generics code
You still can't use primitive types (or nonexistant structs) as generics
Not only instances - you can also declare variables without a generic parameter and then decide what generic parameter to use when instancing. Very usefull for class variables.
And using the Integer/Double/etc classes seems wasteful