@Override public int put(long key){
  long primaryHashValue=primaryHashFunction(key);
  int bucket=(int)(primaryHashValue & bitMask);
  long currentKey=array.get(bucket);
  if (currentKey == defaultGetReturnValue) {
    if (isAtCapacity()) {
      throw new RuntimeException("Exceeded the maximum number of insertions");
    }
    array.set(bucket,key);
    size.getAndIncrement();
    numStoredKeysCounter.incr();
    return bucket;
  }
 else   if (currentKey == key) {
    return bucket;
  }
  int secondaryHashKey=secondaryHashFunction(key,bitMask);
  do {
    bucket=(int)(((long)bucket + secondaryHashKey) & bitMask);
    currentKey=array.get(bucket);
  }
 while ((currentKey != defaultGetReturnValue) && (currentKey != key));
  if (currentKey == defaultGetReturnValue) {
    if (isAtCapacity()) {
      throw new RuntimeException("Exceeded the maximum number of insertions");
    }
    array.set(bucket,key);
    size.getAndIncrement();
    numStoredKeysCounter.incr();
    return bucket;
  }
 else {
    return bucket;
  }
}

@ Override public int put ( long key ) { long primaryHashValue = primaryHashFunction ( key ) ; int bucket = ( int ) ( primaryHashValue & bitMask ) ; long currentKey = array . get ( bucket ) ; if ( currentKey == defaultGetReturnValue ) { if ( isAtCapacity ( ) ) { throw new RuntimeException ( "Exceeded the maximum number of insertions" ) ; } array . set ( bucket , key ) ; size . getAndIncrement ( ) ; numStoredKeysCounter . incr ( ) ; return bucket ; } else if ( currentKey == key ) { return bucket ; } int secondaryHashKey = secondaryHashFunction ( key , bitMask ) ; do { bucket = ( int ) ( ( ( long ) bucket + secondaryHashKey ) & bitMask ) ; currentKey = array . get ( bucket ) ; } while ( ( currentKey != defaultGetReturnValue ) && ( currentKey != key ) ) ; if ( currentKey == defaultGetReturnValue ) { if ( isAtCapacity ( ) ) { throw new RuntimeException ( "Exceeded the maximum number of insertions" ) ; } array . set ( bucket , key ) ; size . getAndIncrement ( ) ; numStoredKeysCounter . incr ( ) ; return bucket ; } else { return bucket ; } }
only a single writer can call this at one time . this method is not thread - safe !
