class RoutesAnswererUtil {

  @Nullable
  static String computeNextHopNode(
      @Nullable Ip nextHopIp, @Nullable Map<Ip, Set<String>> ipOwners) {
    if (nextHopIp == null || ipOwners == null) {
      return null;
    }
    // TODO: https://github.com/batfish/batfish/issues/1862
    return ipOwners.getOrDefault(nextHopIp, ImmutableSet.of()).stream()
        .min(Comparator.naturalOrder())
        .orElse(null);
  }

}