static Queue < Integer > reverseQueue ( Queue < Integer > q ) {
  if ( q . isEmpty ( ) ) return q ;
  int data = q . peek ( ) ;
  q . remove ( ) ;
  q = reverseQueue ( q ) ;
  q . add ( data ) ;
  return q ;
}

static Queue < Integer > reverseQueue ( Queue < Integer > q ) { if ( q . isEmpty ( ) ) return q ; int data = q . peek ( ) ; q . remove ( ) ; q = reverseQueue ( q ) ; q . add ( data ) ; return q ; }
(method_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier) parameters: (formal_parameters (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) consequence: (return_statement (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation name: (identifier) arguments: (argument_list (identifier))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (return_statement (identifier))))