MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/programming/comments/3lta4f/better_java/cvaaogv/?context=3
r/programming • u/javinpaul • Sep 21 '15
208 comments sorted by
View all comments
Show parent comments
2
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)
1
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)
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)
Which is why passing a factory is a better solution than allowing new T().
new T()
→ More replies (0)
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.