private static SearchGroupsImpl toGroups(AvailabilityPolicy availabilityPolicy, Collection<Node> nodes) {
        Map<Integer, Group> groups = new HashMap<>();
        nodes.stream().collect(groupingBy(Node::group)).forEach((groupId, groupNodes) -> {
            groups.put(groupId, new Group(groupId, groupNodes));
        });
        return new SearchGroupsImpl(availabilityPolicy, Map.copyOf(groups));
    }
Sets the new nodes to monitor to be the new nodes, but keep any existing node instances which are equal the new ones.
container-search/src/main/java/com/yahoo/search/dispatch/searchcluster/SearchCluster.java