Methods Summary |
---|
private void | checkKey(int key)
if (key < 0)
throw new IllegalArgumentException( "Key must be >= 0." ) ;
|
private void | extend(int index)
if (index >= list.size()) {
list.ensureCapacity( index + 1 ) ;
int max = list.size() ;
while (max++ <= index)
list.add( null ) ;
}
|
public java.lang.Object | get(int key)If key >= 0, return the value bound to key, or null if none.
Throws IllegalArgumentException if key <0.
checkKey( key ) ;
Object result = null ;
if (key < list.size())
result = list.get( key ) ;
return result ;
|
public void | set(int key, java.lang.Object value)If key >= 0, bind value to the key.
Throws IllegalArgumentException if key <0.
checkKey( key ) ;
extend( key ) ;
list.set( key, value ) ;
|