It's not terribly clean, but you could use indexOf() and check if it returns -1. Better than breaking out a loop.
Data structure and Algorithms, Java workouts ,Problem Solving questions and solutions.(Repository contains major Graph alogirthms like Bellmanford algo,Prim's ,Dijkstra's algorithm).
Results that may be inaccessible to you are currently showing.
Hide inaccessible results