public static int countIdenticalRows ( int mat [ ] [ ] ) {
  int count = 0 ;
  for ( int i = 0 ;
  i < mat . length ;
  i ++ ) {
    HashSet < Integer > hs = new HashSet < > ( ) ;
    for ( int j = 0 ;
    j < mat [ i ] . length ;
    j ++ ) {
      hs . add ( mat [ i ] [ j ] ) ;
    }
    if ( hs . size ( ) == 1 ) count ++ ;
  }
  return count ;
}

public static int countIdenticalRows ( int mat [ ] [ ] ) { int count = 0 ; for ( int i = 0 ; i < mat . length ; i ++ ) { HashSet < Integer > hs = new HashSet < > ( ) ; for ( int j = 0 ; j < mat [ i ] . length ; j ++ ) { hs . add ( mat [ i ] [ j ] ) ; } if ( hs . size ( ) == 1 ) count ++ ; } return count ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (array_access array: (identifier) index: (identifier)) field: (identifier))) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (expression_statement (update_expression (identifier)))))) (return_statement (identifier))))