opendap/src/main/java/opendap/util/SortedTable.java
public synchronized Object put(Object key, Object value) throws NullPointerException {
        if (key == null || value == null)
            throw new NullPointerException();

        int index = keys.indexOf(key);
        if (index != -1) {
            Object prev = elements.elementAt(index);
            elements.setElementAt(value, index);
            return prev;
        } else {
            keys.addElement(key);
            elements.addElement(value);
            return null;
        }
    }
public synchronized Object put(Object key, Object value) throws NullPointerException {
        if (key == null || value == null)
            throw new NullPointerException();

        int index = keys.indexOf(key);
        if (index != -1) {
            Object prev = elements.elementAt(index);
            elements.setElementAt(value, index);
            return prev;
        } else {
            keys.addElement(key);
            elements.addElement(value);
            return null;
        }
    }
public synchronized Object put ( Object key , Object value ) throws NullPointerException { if ( key == null || value == null ) throw new NullPointerException ( ) ; int index = keys . indexOf ( key ) ; if ( index != - 1 ) { Object prev = elements . elementAt ( index ) ; elements . setElementAt ( value , index ) ; return prev ; } else { keys . addElement ( key ) ; elements . addElement ( value ) ; return null ; } }
Maps the specified key to the specified value in this table.

@param key   the key
@param value the value
@return the previous value to which the key is mapped, or null if the
key did not have a previous mapping.
@throws NullPointerException if the key or value is null.
Maps the specified key to the specified value in this table .