May be you can return o2.getSessionId().compareTo(o1.getSessionId())