Possible Duplicate:
How to sort an arraylist of objects by a property?
public static void main(String args[]){
List<Emp> unsortList = new ArrayList<Emp>();
unsortList.add(new Emp(109));
unsortList.add(new Emp(106));
unsortList.add(new Emp(103));
unsortList.add(new Emp(108));
unsortList.add(new Emp(101));
}
public class Emp {
Integer eid;
public Emp(Integer eid) {
this.eid=eid;
}
}
Emp is user defined class & stored in ArrayList. How sort ArrayList.