就比如,我自定义个类,
public class Student{
String name;
int age;
}
public class Students{
public static void main (String[] args){
ArrayList<Student> student = new ArrayList<Student>();
Student s1 = new Student();
s1.name = "张三";
s1.age = 10;
student.add(s1);
}
}
我输入一个字符串,如何用contains,来查找这个字符串是否在这个集合里 |