コード例 #1
0
 @Override
 public boolean equals(Object o) {
   SegmentOrderComparator scc = (SegmentOrderComparator) o;
   return (this.order == scc.getOrder() && this.segment == scc.getSegment());
 }
コード例 #2
0
 @Override
 public int compareTo(SegmentOrderComparator scc) {
   if (scc.equals(this)) return 0;
   else if (this.order != scc.getOrder()) return (this.order > scc.getOrder()) ? 1 : -1;
   else return (this.segment > scc.getSegment()) ? 1 : -1;
 }