static Node insertEnd ( Node head , Node new_node ) {
  if ( head == null ) {
    new_node . next = new_node . prev = new_node ;
    head = new_node ;
    return head ;
  }
  Node last = ( head ) . prev ;
  new_node . next = head ;
  ( head ) . prev = new_node ;
  new_node . prev = last ;
  last . next = new_node ;
  return head ;
}

static Node insertEnd ( Node head , Node new_node ) { if ( head == null ) { new_node . next = new_node . prev = new_node ; head = new_node ; return head ; } Node last = ( head ) . prev ; new_node . next = head ; ( head ) . prev = new_node ; new_node . prev = last ; last . next = new_node ; return head ; }
(method_declaration (modifiers) type: (type_identifier) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier)) (formal_parameter type: (type_identifier) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (block (expression_statement (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (return_statement (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (field_access object: (parenthesized_expression (identifier)) field: (identifier)))) (expression_statement (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (field_access object: (parenthesized_expression (identifier)) field: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (identifier))) (expression_statement (assignment_expression left: (field_access object: (identifier) field: (identifier)) right: (identifier))) (return_statement (identifier))))