public Object put(final Object key,
final Object value,
final boolean checkExists) {
final int hashCode = this.comparator.hashCodeOf( key );
final int index = indexOf( hashCode,
this.table.length );
if ( checkExists ) {
ObjectEntry current = (ObjectEntry) this.table[index];
while ( current != null ) {
if ( hashCode == current.cachedHashCode && this.comparator.equal( key,
current.key ) ) {
final Object oldValue = current.value;
current.value = value;
return oldValue;
}
current = (ObjectEntry) current.getNext();
}
}
final ObjectEntry entry = new ObjectEntry( key,
value,
hashCode );
entry.next = this.table[index];
this.table[index] = entry;
if ( this.size++ >= this.threshold ) {
resize( 2 * this.table.length );
}
return null;
}