@Data
class Person {
private String fname;
private String lname;
private List<String> friends;
private List<BigDecimal> ratings;
...
}
@Data
class People {
private List<Person> people;
...
}
suppose i have the above classes, and need to figure out what is the most number of friends any one person has. I know the pre-streams way of doing it... by looping over every element in the list and checking if friends.size() is greater than the currently stored number of longest list. is there a way to streamline the code with streams? something like this answer?