public void deleteNode ( int node ) { int element = getElement ( node ) ; int hash = m_hash . getHash ( element ) ; int bucket = hash % m_hashBuckets . size ( ) ; int list = m_hashBuckets . get ( bucket ) ; if ( list == - 1 ) throw new IllegalArgumentException ( ) ; int ptr = m_lists . getFirst ( list ) ; int prev = - 1 ; while ( ptr != - 1 ) { if ( ptr == node ) { m_lists . deleteElement ( list , prev , ptr ) ; if ( m_lists . getFirst ( list ) == - 1 ) { m_lists . deleteList ( list ) ; // do not keep empty lists m_hashBuckets . set ( bucket , - 1 ) ; } return ; } prev = ptr ; ptr = m_lists . getNext ( ptr ) ; } throw new IllegalArgumentException ( ) ; }
Removes a node .