private SortedSet<ServerGroup> deriveGroups(List<HostInfo> hosts) {
        serverGroups.clear();
        for (HostInfo host : hosts) {
            List<ServerInstance> serverInstances = host.getServerInstances();
            for (ServerInstance server : serverInstances) {
                String group = server.getGroup();
                String profile = server.getProfile();
                ServerGroup serverGroup = serverGroups.get(group);
                if (serverGroup == null) {
                    serverGroup = new ServerGroup(group, profile);
                    serverGroup.fill(hosts);
                    serverGroups.put(group, serverGroup);
                }
            }
        }
        return new TreeSet<ServerGroup>(serverGroups.values());
    }
private SortedSet < ServerGroup > deriveGroups ( List < HostInfo > hosts ) { serverGroups . clear ( ) ; for ( HostInfo host : hosts ) { List < ServerInstance > serverInstances = host . getServerInstances ( ) ; for ( ServerInstance server : serverInstances ) { String group = server . getGroup ( ) ; String profile = server . getProfile ( ) ; ServerGroup serverGroup = serverGroups . get ( group ) ; if ( serverGroup == null ) { serverGroup = new ServerGroup ( group , profile ) ; serverGroup . fill ( hosts ) ; serverGroups . put ( group , serverGroup ) ; } } } return new TreeSet < ServerGroup > ( serverGroups . values ( ) ) ; }
Builds {@link ServerGroup} instances and populates the map {@link #serverGroups}