public void enqueue(Animal a) {
   a.setOrder(order);
   order++;
   if (a instanceof Dog) dogs.addLast((Dog) a);
   if (a instanceof Cat) cats.addLast((Cat) a);
 }
Example #2
0
 public int compareTo(Animal a) {
   return title.compareTo(a.getTitle());
 }
 public boolean isOlderThan(Animal a) {
   return this.order < a.getOrder();
 }