public V remove(int index) throws IndexOutOfBoundsException
    {
        // Check that the index is not too large
        if (index >= data.size())
        {
            throw new IndexOutOfBoundsException();
        }

        // Get the key for the index by scanning through the key to index mapping
        for (K nextKey : keyToIndex.keySet())
        {
            int nextIndex = keyToIndex.get(nextKey);

            // Found the key for the index, now remove it
            if (index == nextIndex)
            {
                return remove(nextKey);
            }
        }

        // No matching index was found
        throw new IndexOutOfBoundsException();
    }
public V remove(int index) throws IndexOutOfBoundsException
    {
        
        if (index >= data.size())
        {
            throw new IndexOutOfBoundsException();
        }

        
        for (K nextKey : keyToIndex.keySet())
        {
            int nextIndex = keyToIndex.get(nextKey);

            
            if (index == nextIndex)
            {
                return remove(nextKey);
            }
        }

        
        throw new IndexOutOfBoundsException();
    }
public V remove ( int index ) throws IndexOutOfBoundsException { // Check that the index is not too large if ( index >= data . size ( ) ) { throw new IndexOutOfBoundsException ( ) ; } // Get the key for the index by scanning through the key to index mapping for ( K nextKey : keyToIndex . keySet ( ) ) { int nextIndex = keyToIndex . get ( nextKey ) ; // Found the key for the index, now remove it if ( index == nextIndex ) { return remove ( nextKey ) ; } } // No matching index was found throw new IndexOutOfBoundsException ( ) ; }
Removes the specified index from the data structure. This only works if the index already exists.

@param  index The index to remove.

@return The value that stored at that index.

@throws IndexOutOfBoundsException If the index is out of the range covered by this data structure.
Removes the specified index from the data structure . This only works if the index already exists .