I think add
works because it receives a specific type, so the compiler infer the type from java to be XYChart.Data<LocalDate, Number>
.
But with addAll
the map
function is transforming it from java first and now it is XYChart.Data<LocalDate!, Number!>
, then it is used as parameter for the addAll
which can’t accept the, now specifc, type(with !).