コード例 #1
0
  public int compareTo(WeightedEdge that) {
    if (this == that) {
      return 0;
    }
    int comparison = this.weight.compareTo(that.getWeight());
    if (comparison != 0) {
      return comparison;
    }

    return super.compareTo(that);
  }
コード例 #2
0
 @Override
 public boolean equals(Object obj) {
   WeightedEdge e = (WeightedEdge) obj;
   return weight.equals(e.getWeight()) && super.equals(obj);
 }