FileDocCategorySizeDatePackage
DenseIntMapImpl.javaAPI DocJava SE 5 API1389Fri Aug 26 14:54:28 BST 2005com.sun.corba.se.impl.orbutil

DenseIntMapImpl

public class DenseIntMapImpl extends Object
Utility for managing mappings from densely allocated integer keys to arbitrary objects. This should only be used for keys in the range 0..max such that "most" of the key space is actually used.

Fields Summary
private ArrayList
list
Constructors Summary
Methods Summary
private voidcheckKey(int key)


          
    
	if (key < 0)
	    throw new IllegalArgumentException( "Key must be >= 0." ) ;
    
private voidextend(int index)

	if (index >= list.size()) {
	    list.ensureCapacity( index + 1 ) ;
	    int max = list.size() ;
	    while (max++ <= index)
		list.add( null ) ;
	}
    
public java.lang.Objectget(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 voidset(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 ) ;