equals and hashcode of WeightedPair, so now first-second pair equals second-first