comefrom: <awangdev>Majority Number III_1.java
code: public int majorityNumber(ArrayList<Integer> nums, int k) {
          if (nums == null || nums.size() == 0) {
              return -1;
          }
          HashMap<Integer, Integer> map = new HashMap<Integer, Integer>();
          for (Integer num : nums) {
              if (map.containsKey(num)) {
                  map.put(num, map.get(num) + 1);
              } else {
                  if (map.size() == k) {
                      Iterator<Map.Entry<Integer, Integer>> iter = map.entrySet().iterator();
                      while (iter.hasNext()) {
                          Map.Entry<Integer, Integer> entry = iter.next();
                          if (entry.getValue() - 1 == 0) {
                              iter.remove();
                          } else {
                              map.put(entry.getKey(), entry.getValue() - 1);
                          }
                      }
                  } else {
                      map.put(num, 1);
                  }
              }
          }
          
          int result = 0;
          int max = 0;
          for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
              if (entry.getValue() > max) {
                  max = entry.getValue();
                  result = entry.getKey();
              }
          }
          return result;
      }
masked: public int sample_funcname ( ArrayList < Integer > var_0 , int var_1 ) {
    if ( var_0 == null || var_0 . size ( ) == 0 ) {
      return - 1 ;
    }
    HashMap < Integer , Integer > var_2 = new HashMap < Integer , Integer > ( ) ;
    for ( Integer var_3 : var_0 ) {
      if ( var_2 . containsKey ( var_3 ) ) {
        var_2 . put ( var_3 , var_2 . get ( var_3 ) + 1 ) ;
      }
      else {
        if ( var_2 . size ( ) == var_1 ) {
          Iterator < Map . Entry < Integer , Integer >> var_4 = var_2 . entrySet ( ) . iterator ( ) ;
          while ( var_4 . hasNext ( ) ) {
            Map . Entry < Integer , Integer > var_5 = var_4 . next ( ) ;
            if ( var_5 . getValue ( ) - 1 == 0 ) {
              var_4 . remove ( ) ;
            }
            else {
              var_2 . put ( var_5 . getKey ( ) , var_5 . getValue ( ) - 1 ) ;
            }
          }
        }
        else {
          var_2 . put ( var_3 , 1 ) ;
        }
      }
    }
    int var_6 = 0 ;
    int var_7 = 0 ;
    for ( Map . Entry < Integer , Integer > var_5 : var_2 . entrySet ( ) ) {
      if ( var_5 . getValue ( ) > var_7 ) {
        var_7 = var_5 . getValue ( ) ;
        var_6 = var_5 . getKey ( ) ;
      }
    }
    return var_6 ;
  }
  