1 package org.hibernate.test.annotations; 3 4 import java.util.Comparator ; 5 6 11 public class TicketComparator implements Comparator <Ticket> { 12 13 public int compare(Ticket ticket, Ticket ticket1) { 14 if (ticket == null || ticket1 == null) { 15 throw new IllegalStateException ("Ticket comparison only available through non null tickets"); 16 } 17 return ticket1.getNumber().length() - ticket.getNumber().length(); 18 19 } 20 } 21 | Popular Tags |