All pastes #476103 Raw Edit

Stuff

public java v1 · immutable
·published 2007-05-07 21:42 UTC
rendered paste body
private void eliminateDuplicates( LinkedList list, Vector states)    {        for( int j = 0; j < states.size(); j++ )        {            Node temp = (Node) states.elementAt( j );	    Iterator it = list.listIterator();	    while (it.hasNext()) {		Node n = (Node) it.next();		if (n.state.equals(temp.state)) {		    // found the state in the list		    if (n.heuristic < temp.heuristic) {			// what's already in the list is better than the one			// in states, so don't need that one.			states.removeElementAt(j);			break;		    }		    else {			// the new state is better than the one on the list,			// so can get rid of the one on the list			it.remove();			break;		    }		}	    }	}