Following code is throwing NPE for the property Salary being null.
class Person has properties: string: name, Integer: age, Integer: salary
salary
can be null here. I want to create a List of salaries.
persons.stream().mapToDouble(Person::getSalary).boxed().collect(Collectors.toList())
Here I must retain null values in the result list. null can not be replaced with 0.