public boolean isPresent ( int accessor ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . entry ( this , tc , "isPresent" , new Object [ ] { Integer . valueOf ( accessor ) } ) ; boolean result ; if ( accessor < cacheSize ) { result = super . isPresent ( accessor ) ; } else if ( accessor < firstBoxed ) { result = getCase ( accessor - cacheSize ) > - 1 ; } else if ( accessor < accessorLimit ) { // Conservative answer: a boxed value is present if its containing box is present; // this is enough to support creation of the JSBoxedImpl for the value, which can // then be interrogated element by element. synchronized ( getMessageLockArtefact ( ) ) { result = super . isPresent ( boxManager . getBoxAccessor ( accessor - firstBoxed ) ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "isPresent" , "IndexOutOfBoundsException" ) ; throw new IndexOutOfBoundsException ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) JmfTr . exit ( this , tc , "isPresent" , Boolean . valueOf ( result ) ) ; return result ; }
The BoxManager stuff is a black art so we ll lock round it to be safe .