public HostAndWeight[] getTopHostsWithWeights() {
    NavigableSet<HostAndWeight> orderedHosts = new TreeSet<>(new HostAndWeight.WeightComparator());
    orderedHosts.addAll(this.hostAndWeights.values());
    return orderedHosts.descendingSet().toArray(new HostAndWeight[orderedHosts.size()]);
  }
Return the sorted list of hosts in terms of their weights
hbase-common/src/main/java/org/apache/hadoop/hbase/HDFSBlocksDistribution.java