コード例 #1
0
 public void orderSorting() {
   for (int i = 0; i < this.order.size(); i++) {
     Order order1 = this.order.get(i);
     for (int p = 0; p < this.order.size(); p++) {
       Order order2 = this.order.get(p);
       int compare = order1.compareTo(order2);
       if (compare % 10 < 2) {
         int order1Index = this.order.indexOf(order1);
         this.order.remove(p);
         this.order.add(p, order1);
         this.order.remove(order1Index);
         this.order.add(order1Index, order2);
         order1 = order2;
       }
     }
   }
   for (int i = 0; i < this.order.size(); i++) {
     Order order1 = this.order.get(i);
     for (int p = 0; p < this.order.size(); p++) {
       Order order2 = this.order.get(p);
       int compare = order1.compareTo(order2);
       if ((compare / 1000 < 2) && (compare % 10 == 0)) {
         int order1Index = this.order.indexOf(order1);
         this.order.remove(p);
         this.order.add(p, order1);
         this.order.remove(order1Index);
         this.order.add(order1Index, order2);
         order1 = order2;
       }
     }
   }
 }
コード例 #2
0
 @Test
 public void testCompareTo() {
   assertThat(order1.compareTo(order2), is(0));
   assertThat(order2.compareTo(order1), is(0));
   assertThat(order1.compareTo(order3) > 0, is(true));
 }
コード例 #3
0
 public int compareTo(Language other) {
   final int diff = myOrder.compareTo(other.myOrder);
   return diff != 0 ? diff : mySortKey.compareTo(other.mySortKey);
 }