I have a class that contains the user data.
public class UserData {
@JsonProperty("uid")
private String userId;
@JsonProperty("cities")
private List<Integer> cities;
}
From the List<UserData>
, I want to extract all the unique cities. Changes, I am doing for this,
Set<Integer> citiesList = new HashSet<>();
for (UserData userData : userDataList)
citiesList.addAll(userData.getCities());
What could be the lambda
expressions of these changes?
Any help would be much appreciated.