I am using Java 7. Is it possible to get the index of an Object in an ArrayList depending on a particular attribute value. eg:
class Abc{
String first_name;
String last_name;
// getter and setters...
}
Now
List<Abc> abcList = new ArrayList();
Abc abcObj = new Abc();
abcObj.setFirst_name("Jeet");
abcObj.setLast_name("Adhikari");
abcList.add(abcObj);
Abc abcObj2 = new Abc();
abcObj2.setFirst_name("John");
abcObj2.setLast_name("Something");
abcList.add(abcObj2);
Now is there any better way without iterating to get the index of the object in abcList where name = "John".