private void addConnectionGroups(Collection<ConnectionGroup> connectionGroups){
  for (  ConnectionGroup connectionGroup : connectionGroups) {
    APIConnectionGroup parent=retrievedGroups.get(connectionGroup.getParentIdentifier());
    if (parent != null) {
      Collection<APIConnectionGroup> children=parent.getChildConnectionGroups();
      if (children == null) {
        children=new ArrayList<APIConnectionGroup>();
        parent.setChildConnectionGroups(children);
      }
      APIConnectionGroup apiConnectionGroup=new APIConnectionGroup(connectionGroup);
      retrievedGroups.put(connectionGroup.getIdentifier(),apiConnectionGroup);
      children.add(apiConnectionGroup);
    }
 else     logger.debug("Connection group \"{}\" cannot be added to the tree: parent \"{}\" does not actually exist.",connectionGroup.getIdentifier(),connectionGroup.getParentIdentifier());
  }
}

private void addConnectionGroups ( Collection < ConnectionGroup > connectionGroups ) { for ( ConnectionGroup connectionGroup : connectionGroups ) { APIConnectionGroup parent = retrievedGroups . get ( connectionGroup . getParentIdentifier ( ) ) ; if ( parent != null ) { Collection < APIConnectionGroup > children = parent . getChildConnectionGroups ( ) ; if ( children == null ) { children = new ArrayList < APIConnectionGroup > ( ) ; parent . setChildConnectionGroups ( children ) ; } APIConnectionGroup apiConnectionGroup = new APIConnectionGroup ( connectionGroup ) ; retrievedGroups . put ( connectionGroup . getIdentifier ( ) , apiConnectionGroup ) ; children . add ( apiConnectionGroup ) ; } else logger . debug ( "Connection group \"{}\" cannot be added to the tree: parent \"{}\" does not actually exist." , connectionGroup . getIdentifier ( ) , connectionGroup . getParentIdentifier ( ) ) ; } }
adds each of the provided connection groups to the current tree as children of their respective parents . the parent connection groups must already be added .
