public void arrangeHostSecondariesFirst() {
    hosts = getHighAvailabilityHosts().stream()
      .flatMap(each -> Stream.concat(each.getSecondaries().stream(), Stream.of(each.getMaster())))
      .collect(toCollection(LinkedHashSet::new));
  }
Order the hosts so that for each HA host the secondaries come first.
For example: [sec1, sec2, master1, sec3, sec4, master2]
ambari-server/src/main/java/org/apache/ambari/server/stack/HostsType.java