public int countkNN(TObjectIntHashMap<Object> counters,Object l){
  if (l instanceof LabelList) {
    LabelList ll=(LabelList)l;
    int m=0;
    for (int i=0, e=ll.size(); i < e; i++) {
      m=Math.max(m,counters.adjustOrPutValue(ll.get(i),1,1));
    }
    return m;
  }
  return counters.adjustOrPutValue(l,1,1);
}

public int countkNN ( TObjectIntHashMap < Object > counters , Object l ) { if ( l instanceof LabelList ) { LabelList ll = ( LabelList ) l ; int m = 0 ; for ( int i = 0 , e = ll . size ( ) ; i < e ; i ++ ) { m = Math . max ( m , counters . adjustOrPutValue ( ll . get ( i ) , 1 , 1 ) ) ; } return m ; } return counters . adjustOrPutValue ( l , 1 , 1 ) ; }
counting helper for knn classification .
