public synchronized boolean addSorted(int key, int value) {

        if (count == capacity) {
            if (fixedSize) {
                return false;
            } else {
                doubleCapacity();
            }
        }

        if (count != 0 && value < values[count - 1]) {
            return false;
        }

        hasChanged    = true;
        keys[count]   = key;
        values[count] = value;

        count++;

        return true;
    }
public synchronized boolean addSorted ( int key , int value ) { if ( count == capacity ) { if ( fixedSize ) { return false ; } else { doubleCapacity ( ) ; } } if ( count != 0 && value < values [ count - 1 ] ) { return false ; } hasChanged = true ; keys [ count ] = key ; values [ count ] = value ; count ++ ; return true ; }
Adds a key, value pair into the table with the guarantee that the key
is equal or larger than the largest existing key. This prevents a sort
from taking place on next call to find()

@param key the key
@param value the value
@return true or false depending on success