Collectors.to* signatures (original) (raw)

Olexandr Demura oleksander.demura at gmail.com
Fri Apr 19 02:59:01 PDT 2013


+1. Part of java community already adopted old pretty upper-bounded wildcard to mark unmodifiable collections, despite common guideline to avoid wildcard as a -plague- return type. http://docs.oracle.com/javase/tutorial/java/generics/wildcardGuidelines.html

2013/4/19 Michael Nascimento <misterm at gmail.com>

Hi guys,

Just got bitten by the fact toList() might produce an immutable list. Since we don't have immutable collections as types in Java, I wonder if the old ugly List<? extends T> wouldn't be a better return type, effectively preventing people from doing what I did. Regards, Michael



More information about the lambda-dev mailing list