private static List < String > transpose ( List < String > grid ) {
  if ( grid . isEmpty ( ) ) {
    return new ArrayList < > ( ) ;
  }
  else {
    final int W = grid . get ( 0 ) . length ( ) ;
    return IntStream . range ( 0 , W ) . boxed ( ) . map ( i -> grid . stream ( ) . map ( row -> row . substring ( i , i + 1 ) ) . collect ( joining ( ) ) ) . collect ( Collectors . toList ( ) ) ;
  }
}

private static List < String > transpose ( List < String > grid ) { if ( grid . isEmpty ( ) ) { return new ArrayList < > ( ) ; } else { final int W = grid . get ( 0 ) . length ( ) ; return IntStream . range ( 0 , W ) . boxed ( ) . map ( i -> grid . stream ( ) . map ( row -> row . substring ( i , i + 1 ) ) . collect ( joining ( ) ) ) . collect ( Collectors . toList ( ) ) ; } }
(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: (block (return_statement (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) alternative: (block (local_variable_declaration (modifiers) type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))) name: (identifier) arguments: (argument_list)))) (return_statement (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (identifier))) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (identifier) right: (decimal_integer_literal))))))) name: (identifier) arguments: (argument_list (method_invocation name: (identifier) arguments: (argument_list))))))) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))))