private static boolean union ( int [ ] parentIds , int [ ] groupSizes , int a , int b ) {
  int rootA = root ( parentIds , a ) ;
  int rootB = root ( parentIds , b ) ;
  if ( rootA == rootB ) {
    return false ;
  }
  if ( groupSizes [ rootA ] < groupSizes [ rootB ] ) {
    parentIds [ rootA ] = rootB ;
    groupSizes [ rootB ] += groupSizes [ rootA ] ;
  }
  else {
    parentIds [ rootB ] = rootA ;
    groupSizes [ rootA ] += groupSizes [ rootB ] ;
  }
  return true ;
}

private static boolean union ( int [ ] parentIds , int [ ] groupSizes , int a , int b ) { int rootA = root ( parentIds , a ) ; int rootB = root ( parentIds , b ) ; if ( rootA == rootB ) { return false ; } if ( groupSizes [ rootA ] < groupSizes [ rootB ] ) { parentIds [ rootA ] = rootB ; groupSizes [ rootB ] += groupSizes [ rootA ] ; } else { parentIds [ rootB ] = rootA ; groupSizes [ rootA ] += groupSizes [ rootB ] ; } return true ; }
(method_declaration (modifiers) type: (boolean_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (return_statement (false)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))))) (return_statement (true))))