@Override
      public int compare(HostAndWeight l, HostAndWeight r) {
        if (l.getWeight() == r.getWeight()) {
          return l.getHost().compareTo(r.getHost());
        }
        return l.getWeight() < r.getWeight() ? -1 : 1;
      }
Comparator used to sort hosts based on weight
hbase-common/src/main/java/org/apache/hadoop/hbase/HDFSBlocksDistribution.java