static int countMinimum ( Node head ) {
  HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ;
  Node current = head ;
  while ( current != null ) {
    int data = current . key ;
    mp . put ( data , ( mp . get ( data ) == null ? 1 : mp . get ( data ) + 1 ) ) ;
    current = current . next ;
  }
  current = head ;
  int min_frequency = Integer . MAX_VALUE , countMin = 0 ;
  for ( Map . Entry < Integer , Integer > it : mp . entrySet ( ) ) {
    if ( it . getValue ( ) <= min_frequency ) {
      min_frequency = it . getValue ( ) ;
    }
  }
  for ( Map . Entry < Integer , Integer > it : mp . entrySet ( ) ) {
    if ( it . getValue ( ) == min_frequency ) {
      countMin += ( it . getValue ( ) ) ;
    }
  }
  return countMin ;
}

static int countMinimum ( Node head ) { HashMap < Integer , Integer > mp = new HashMap < Integer , Integer > ( ) ; Node current = head ; while ( current != null ) { int data = current . key ; mp . put ( data , ( mp . get ( data ) == null ? 1 : mp . get ( data ) + 1 ) ) ; current = current . next ; } current = head ; int min_frequency = Integer . MAX_VALUE , countMin = 0 ; for ( Map . Entry < Integer , Integer > it : mp . entrySet ( ) ) { if ( it . getValue ( ) <= min_frequency ) { min_frequency = it . getValue ( ) ; } } for ( Map . Entry < Integer , Integer > it : mp . entrySet ( ) ) { if ( it . getValue ( ) == min_frequency ) { countMin += ( it . getValue ( ) ) ; } } return countMin ; }
(method_declaration (modifiers) type: (integral_type) 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 (type_identifier) (type_identifier))) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (parenthesized_expression (ternary_expression condition: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (null_literal)) consequence: (decimal_integer_literal) alternative: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (field_access object: (identifier) field: (identifier)))))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (field_access object: (identifier) field: (identifier))) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (enhanced_for_statement type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (enhanced_for_statement type: (generic_type (scoped_type_identifier (type_identifier) (type_identifier)) (type_arguments (type_identifier) (type_identifier))) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (identifier))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))))))) (return_statement (identifier))))