Java implementation of dijsktra's algorithm using priority queue