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,017
  • 3
  • 17
  • 14
Antoniossss
  • 28,922
  • 5
  • 49
  • 91

0 Answers0