public void append ( K key , V value ) { int index = mSize ; final int hash = key == null ? 0 : key . hashCode ( ) ; if ( index >= mHashes . length ) { throw new IllegalStateException ( "Array is full" ) ; } if ( index > 0 && mHashes [ index - 1 ] > hash ) { RuntimeException e = new RuntimeException ( "here" ) ; e . fillInStackTrace ( ) ; Log . w ( TAG , "New hash " + hash + " is before end of array hash " + mHashes [ index - 1 ] + " at index " + index + " key " + key , e ) ; put ( key , value ) ; return ; } mSize = index + 1 ; mHashes [ index ] = hash ; index <<= 1 ; mArray [ index ] = key ; mArray [ index + 1 ] = value ; }
Special fast path for appending items to the end of the array without validation . The array must already be large enough to contain the item .