How, technically speaking, collect(toList()) can return Object?
Stream y = Stream.of("X");
Object l = y.collect(Collectors.toList());
I would not be surprised by List, but Object that surprising.
How, technically speaking, collect(toList()) can return Object?
Stream y = Stream.of("X");
Object l = y.collect(Collectors.toList());
I would not be surprised by List, but Object that surprising.
It can return List<String>
also, but it is normal to get an Object
because List
is extended from Object
.
final List<String> x = Stream.of("X").collect(Collectors.toList());