我在练习中遇到了问题。练习是关于团队的。用户必须输入运动员的姓名和年龄、球队的姓名和住所以及运动的名称。当用户按下“创建运动员”按钮时,会出现一个 Joptionpane.inputdialog 询问他要将运动员放在哪个团队中。
我的问题是如何检查该团队是否存在于 arraylist 团队中,以及如何将运动员放置在该团队中。
if(e.getSource() == createAthlete){
    String nameA = athleteName.getText();
    Athlete A = new Athlete(nameA,Integer.parseInt(athleteAge.getText()));
    String team= JOptionPane.showInputDialog("In what team do you want to place the athlete?);
}
public class  Championship {
    private String name;
    private int durationMonths;
    private static ArrayList<Championship> cship = new ArrayList<Championship>();
    private static ArrayList<Club> clubs = new ArrayList<Club>();
    public Championship(String name, int durationMonths){
        this.name = name;
        this.durationMonths = durationMonths;
    }
    public static void addChampioship(Championship c){
        cship.add(c);
    }
    public static void addClub(Club club){
        clubs.add(club);
    }
}
非常紧急,所以提前感谢您的回复