--- android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/DepartureBean.java 2009/09/10 18:10:42 306 +++ android/TrainInfoService/src/dk/thoerup/traininfoservice/banedk/DepartureBean.java 2009/09/10 18:11:53 307 @@ -1,6 +1,6 @@ package dk.thoerup.traininfoservice.banedk; -public class DepartureBean { +public class DepartureBean implements Comparable { private String time; private int updated; private String trainNumber; @@ -60,5 +60,18 @@ this.note = note; } + @Override + public int compareTo(Object arg0) { + DepartureBean otherBean = (DepartureBean) arg0; + + int time1 = Integer.parseInt(time.replace(":", "")); + int time2 = Integer.parseInt(otherBean.time.replace(":", "")); + if (time1 > time2) + return 1; + else + return -1; + + } + }