@Override
  public double compare(City record1, City record2) {
    String first = record1.getName().replaceAll("[^\\w^\\s]", "").toLowerCase();
    String second = record2.getName().replaceAll("[^\\w^\\s]", "").toLowerCase();

    return sim.calculate(first, second);
  }
 @Override
 public boolean equals(Object obj) {
   // simplified equality checking for the union conflict resolution
   // you should use the IDs here which you also used in the identity resolution
   if (obj instanceof City) {
     City c = (City) obj;
     return getName().equals(c.getName());
   } else {
     return false;
   }
 }
  @Override
  public double compare(City record1, City record2) {
    Double first = record1.getLongitude();
    Double second = record2.getLongitude();

    if (first == null || second == null) return 0d;

    if (first < 0 || second < 0) {
      first = Math.abs(first);
      second = Math.abs(second);
    }

    return sim.calculate(first, second);
  }
 @Override
 public String getBlockingKey(City instance) {
   return instance.getName().toLowerCase().substring(0, 2);
 }