I understand that Collections.sort(list)
does the work for a list of strings, but what about list of Object? Say I have this object Contact
:
public class Contact implements Serializable {
private SerializableBitmap picture;
private String name;
private String location;
public Contact() {
}
public void setPicture(SerializableBitmap picture) {
this.picture = picture;
}
public void setName(String name) {
this.name = name;
}
public void setLocation(String location) {
this.location = location;
}
public SerializableBitmap getPicture() {
return picture;
}
public String getName() {
return name;
}
public String getLocation() {
return location;
}
}
Then I have an ArrayList of this object. Is it possible to sort the list based on Contact name? I'm trying to populate it with ListView, but it should be in ascending order.