int addKey(BufferedString str) {
    // _map is shared and be cast to null (if categorical is killed) -> grab local copy
    IcedHashMap<BufferedString, Integer> m = _map;
    if( m == null ) return Integer.MAX_VALUE;     // Nuked already
    Integer res = m.get(str);
    if( res != null ) return res; // Recorded already
    assert str.length() < 65535; // Length limit so 65535 can be used as a sentinel
    int newVal = _id.incrementAndGet();
    res = m.putIfAbsent(new BufferedString(str), newVal);
    if( res != null ) return res;
    if( m.size() > MAX_CATEGORICAL_COUNT) maxDomainExceeded = true;
    return newVal;
  }
int addKey ( BufferedString str ) { IcedHashMap < BufferedString , Integer > m = _map ; if ( m == null ) return Integer . MAX_VALUE ; Integer res = m . get ( str ) ; if ( res != null ) return res ; assert str . length ( ) < 65535 ; int newVal = _id . incrementAndGet ( ) ; res = m . putIfAbsent ( new BufferedString ( str ) , newVal ) ; if ( res != null ) return res ; if ( m . size ( ) > MAX_CATEGORICAL_COUNT ) maxDomainExceeded = true ; return newVal ; }
Add key to this map (treated as hash set in this case).