protected Object addOrRemove ( int intKey , Object objectValue , boolean remove ) { int hash = intKey ; int index = hashIndex . getHashIndex ( hash ) ; int lookup = hashIndex . hashTable [ index ] ; int lastLookup = - 1 ; Object returnValue = null ; for ( ; lookup >= 0 ; lastLookup = lookup , lookup = hashIndex . getNextLookup ( lookup ) ) { if ( intKey == intKeyTable [ lookup ] ) { break ; } } if ( lookup >= 0 ) { if ( remove ) { if ( intKey == 0 ) { hasZeroKey = false ; zeroKeyIndex = - 1 ; } intKeyTable [ lookup ] = 0 ; returnValue = objectValueTable [ lookup ] ; objectValueTable [ lookup ] = null ; hashIndex . unlinkNode ( index , lastLookup , lookup ) ; if ( accessTable != null ) { accessTable [ lookup ] = 0 ; } return returnValue ; } if ( isObjectValue ) { returnValue = objectValueTable [ lookup ] ; objectValueTable [ lookup ] = objectValue ; } if ( accessTable != null ) { accessTable [ lookup ] = accessCount ++ ; } return returnValue ; } // not found if ( remove ) { return returnValue ; } if ( hashIndex . elementCount >= threshold ) { if ( reset ( ) ) { return addOrRemove ( intKey , objectValue , remove ) ; } else { return null ; } } lookup = hashIndex . linkNode ( index , lastLookup ) ; intKeyTable [ lookup ] = intKey ; if ( intKey == 0 ) { hasZeroKey = true ; zeroKeyIndex = lookup ; } objectValueTable [ lookup ] = objectValue ; if ( accessTable != null ) { accessTable [ lookup ] = accessCount ++ ; } return returnValue ; }
type - specific method for adding or removing keys in int - > Object maps