@Test public void testComputeNextHopNode() { assertThat(computeNextHopNode(null, ImmutableMap.of()), nullValue()); assertThat(computeNextHopNode(Ip.parse("1.1.1.1"), null), nullValue()); assertThat(computeNextHopNode(Ip.parse("1.1.1.1"), ImmutableMap.of()), nullValue()); assertThat( computeNextHopNode( Ip.parse("1.1.1.1"), ImmutableMap.of(Ip.parse("1.1.1.1"), ImmutableSet.of("n1"))), equalTo("n1")); assertThat( computeNextHopNode( Ip.parse("1.1.1.1"), ImmutableMap.of(Ip.parse("1.1.1.2"), ImmutableSet.of("n1"))), nullValue()); }
@Nullable static String computeNextHopNode( @Nullable Ip nextHopIp, @Nullable Map<Ip, Set<String>> ipOwners) { if (nextHopIp == null || ipOwners == null) { return null; } return ipOwners.getOrDefault(nextHopIp, ImmutableSet.of()).stream() .min(Comparator.naturalOrder()) .orElse(null); }
RoutesAnswererUtil { @Nullable static String computeNextHopNode( @Nullable Ip nextHopIp, @Nullable Map<Ip, Set<String>> ipOwners) { if (nextHopIp == null || ipOwners == null) { return null; } return ipOwners.getOrDefault(nextHopIp, ImmutableSet.of()).stream() .min(Comparator.naturalOrder()) .orElse(null); } }
RoutesAnswererUtil { @Nullable static String computeNextHopNode( @Nullable Ip nextHopIp, @Nullable Map<Ip, Set<String>> ipOwners) { if (nextHopIp == null || ipOwners == null) { return null; } return ipOwners.getOrDefault(nextHopIp, ImmutableSet.of()).stream() .min(Comparator.naturalOrder()) .orElse(null); }  }
RoutesAnswererUtil { @Nullable static String computeNextHopNode( @Nullable Ip nextHopIp, @Nullable Map<Ip, Set<String>> ipOwners) { if (nextHopIp == null || ipOwners == null) { return null; } return ipOwners.getOrDefault(nextHopIp, ImmutableSet.of()).stream() .min(Comparator.naturalOrder()) .orElse(null); }  static Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> groupRoutes(
          SortedMap<String, SortedMap<String, GenericRib<T>>> ribs,
          Set<String> matchingNodes,
          @Nullable Prefix network,
          String vrfRegex,
          RoutingProtocolSpecifier protocolSpec,
          @Nullable Map<Ip, Set<String>> ipOwners); static List<DiffRoutesOutput> getRoutesDiff(
      Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> routesInBase,
      Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> routesInRef); }
RoutesAnswererUtil { @Nullable static String computeNextHopNode( @Nullable Ip nextHopIp, @Nullable Map<Ip, Set<String>> ipOwners) { if (nextHopIp == null || ipOwners == null) { return null; } return ipOwners.getOrDefault(nextHopIp, ImmutableSet.of()).stream() .min(Comparator.naturalOrder()) .orElse(null); }  static Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> groupRoutes(
          SortedMap<String, SortedMap<String, GenericRib<T>>> ribs,
          Set<String> matchingNodes,
          @Nullable Prefix network,
          String vrfRegex,
          RoutingProtocolSpecifier protocolSpec,
          @Nullable Map<Ip, Set<String>> ipOwners); static List<DiffRoutesOutput> getRoutesDiff(
      Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> routesInBase,
      Map<RouteRowKey, Map<RouteRowSecondaryKey, SortedSet<RouteRowAttribute>>> routesInRef);  }