private static Map < Character , Integer > countCharFrequencies ( String str ) {
  Map < Character , Integer > map = new HashMap < > ( ) ;
  str . chars ( ) . mapToObj ( i -> ( char ) i ) . forEach ( c -> {
    if ( map . containsKey ( c ) ) {
      map . put ( c , map . get ( c ) + 1 ) ;
    }
    else {
      map . put ( c , 1 ) ;
    }
  }
  ) ;
  return map ;
}

private static Map < Character , Integer > countCharFrequencies ( String str ) { Map < Character , Integer > map = new HashMap < > ( ) ; str . chars ( ) . mapToObj ( i -> ( char ) i ) . forEach ( c -> { if ( map . containsKey ( c ) ) { map . put ( c , map . get ( c ) + 1 ) ; } else { map . put ( c , 1 ) ; } } ) ; return map ; }
(method_declaration (modifiers) type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier))) body: (block (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier) (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (expression_statement (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: (cast_expression type: (integral_type) value: (identifier))))) name: (identifier) arguments: (argument_list (lambda_expression parameters: (identifier) body: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal)))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (decimal_integer_literal))))))))))) (return_statement (identifier))))