java - How to sort array object by specific string field? -
this class of object (i need timestamp string):
public class evento{ public string timestamp; public evento(string timestamp) { super(); this.timestamp = timestamp; } public string gettimestamp() { return timestamp; } }
in activity have:
evento evento = new evento[10]; for(int = 0; i<10; i++) evento[i] = new evento(/*casual string timestamp*/);
then have populated array, how can sort timestamp inserted?
as stated, going need custom implementation of comparator interace. since string, first convert timestamp date object: converting string timestamp date , , follow example sort date sort objects in arraylist date?
Comments
Post a Comment