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); }
@Override public boolean equals(Object obj) { WeightedEdge e = (WeightedEdge) obj; return weight.equals(e.getWeight()) && super.equals(obj); }