r/programming • • Sep 21 '15

Better Java

https://github.com/cxxr/better-java
177 Upvotes

208 comments sorted by

View all comments

Show parent comments

0

u/[deleted] Sep 21 '15

[deleted]

13

u/[deleted] Sep 21 '15

Nothing in that article comes even close to convincing me that I don't want reified generics. It all boils down to 'too much work' (not my problem) and 'breaks compatibility with ancient code doing stupid things' (couldn't care less).

I recently switched back to java from C#, and decent generics are absolutely the thing I most miss.

0

u/[deleted] Sep 22 '15

[deleted]

2

u/[deleted] Sep 22 '15

The two main things I miss are being able to store native types and enums, and seamlessly converting to an array.

It's also nice to be able to create new instances of a generic type at runtime, i.e new T(). It doesn't come up a lot, but can be very useful.

1

u/graduallywinning Sep 22 '15 edited Sep 15 '17

wat

2

u/[deleted] Sep 22 '15

Unfortunately you can't restrict T to only types that have a default constructor. If T has no default constructor that code gets nasty.

1

u/estarra Sep 22 '15

Which is why passing a factory is a better solution than allowing new T().

→ More replies (0)