@ Override public int compareTo ( VehicleMessage other ) { CanMessage otherMessage = ( CanMessage ) other ; if ( getBusId ( ) < otherMessage . getBusId ( ) ) { return - 1 ; } else if ( getBusId ( ) > otherMessage . getBusId ( ) ) { return 1 ; } else { if ( getId ( ) < otherMessage . getId ( ) ) { return - 1 ; } else if ( getId ( ) > otherMessage . getId ( ) ) { return 1 ; } } return 0 ; }
Sort by bus then by message ID .