public static void dfs ( int u , boolean [ ] visited , List < Integer > temp ) {
  visited [ u ] = true ;
  temp . add ( u ) ;
  Iterator itr = adj [ u ] . listIterator ( ) ;
  while ( itr . hasNext ( ) ) {
    int v = ( int ) itr . next ( ) ;
    if ( ! visited [ v ] ) dfs ( v , visited , temp ) ;
  }
}

public static void dfs ( int u , boolean [ ] visited , List < Integer > temp ) { visited [ u ] = true ; temp . add ( u ) ; Iterator itr = adj [ u ] . listIterator ( ) ; while ( itr . hasNext ( ) ) { int v = ( int ) itr . next ( ) ; if ( ! visited [ v ] ) dfs ( v , visited , temp ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (array_type element: (boolean_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier))) body: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (true))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (array_access array: (identifier) index: (identifier)) name: (identifier) arguments: (argument_list)))) (while_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (if_statement condition: (parenthesized_expression (unary_expression operand: (array_access array: (identifier) index: (identifier)))) consequence: (expression_statement (method_invocation name: (identifier) arguments: (argument_list (identifier) (identifier) (identifier)))))))))