class IpOwners {

  @VisibleForTesting
  static void processHsrpGroups(
      Map<Ip, Map<String, Set<String>>> ipOwners, Table<Ip, Integer, Set<Interface>> hsrpGroups) {
    hsrpGroups
        .cellSet()
        .forEach(
            cell -> {
              Ip ip = cell.getRowKey();
              assert ip != null;
              Integer groupNum = cell.getColumnKey();
              assert groupNum != null;
              Set<Interface> candidates = cell.getValue();
              assert candidates != null;
              /*
               * Compare priorities first. If tied, break tie based on highest interface IP.
               */
              Interface hsrpMaster =
                  Collections.max(
                      candidates,
                      Comparator.comparingInt(
                              (Interface i) -> i.getHsrpGroups().get(groupNum).getPriority())
                          .thenComparing(i -> i.getConcreteAddress().getIp()));
              ipOwners
                  .computeIfAbsent(ip, k -> new HashMap<>())
                  .computeIfAbsent(hsrpMaster.getOwner().getHostname(), k -> new HashSet<>())
                  .add(hsrpMaster.getName());
            });
  }

  public  IpOwners(Map<String, Configuration> configurations);

}