Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've been doing List<String> list = new ArrayList<>();

Isn't that good enough?



For your example, it makes no difference. However, take a look at the other example mentioned at the beginning:

    var stream = list.stream();   // infers Stream<String>
How would you write it in order to take advantage of type inference?


No.

The List<String> is almost as redundant as the RHS <String> was.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: