Bidirectional Dijkstra's Algorithm in Java