I have the below method that I would like to rewrite using streams.
I was thinking to write a method and call that using stream().forEach() but not sure on how to map the return.
List<Student> students = new ArrayList<>();
if(myService.getData()!=null){
for(Person person: myService.getData().getPersons()) {
Student student = new Student();
student.setGender(person.getSex());
student.setGpa(person.getScore);
students.add(student);
}
}