Added a generic Dijkstra's algorithm in Java.