I\' have a question about initialization of List in the POJO as it follows the next code:
public class Person {
//other fields...
private List
I would suggest this:
public class Person {
//other fields...
private List friends=new ArrayList<>();
// returns a copy to protect original list
public List getFriends() {
Collections.unmodifiableList(new ArrayList<>(friends));
}
public void addFriend(String> friend) {
this.friends.add(friend);
}
public void addFriends(List friends) {
this.friends.addAll(friends);
}
}