how to get a specific java object from java.util.List<Object> using equals method
exemple :
Class Person{
String name;
int age;
//...
@Override
public boolean equals(String str) {
return (this.name.equals(str.name));
}
}
main{
List<Person> list = personDao.findAll();
if(list.contain("joe")){
// how to get the Person named joe ????
}
}
If you want to get a reference to the specific Person in the List:
This will only find the first Person named joe.