Cloud Stack Ninja

In Java, I have a class Team contains a list of teammate

public class Team{
     private List<Teammate> tm =new ArrayList<>();
     public List<Teammate> getPersons(){return tm;}
     public void addTeammate(String name){tm.add(new Teammate(name));}

//nested class
     public final static class Teammate{
     private String name;
     public String getName(){return;}
     private Teammate(String name){;}

After that I want to initialize a Team and add new Teammates to the Team, how can I do it elegant? Thanks!

Read more here:

Content Attribution

This content was originally published by Pichu Sir at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: