To discard repeated vertexes you could put your vertexes to LinkedHashMap and in your code check if vertex is in the map.
If you are building a graph then you could learn from the code for graphs in book "Algorithms" by Robert Sedgewick and Kevin Wayne.