I\'m trying to group Java objects by their field, i.e Person.java
public class Person {
String name;
String surname;
....
}
First of all you should add objects of Person.java in the arraylist later we can get back those details in below manner
public void addPerson(){
ArrayList presonList = new ArrayList();
for( int i=0;i<=presonList.size() ; i++){
Person obj = presonList.get(i);
//now do the stuff of getting individual variable here
}
}