0

Consider having 2 snippets

List<?> list=...
list.stream().map(Map.class::cast).map(m->m.get("whatever")). ... //compiles and works fine

List rawList=...
rawList.stream().map(Map.class::cast).map(m->m.get("whatever")). ... //does not compile

Second stream casting does not work as map returns Stream while in first example it returns Stream<Map>. Why is that?

Gyro Gearless
  • 5,131
  • 3
  • 18
  • 14
Antoniossss
  • 31,590
  • 6
  • 57
  • 99

0 Answers0