How to get input from user with treeset in java?
<p>I am using <code>Treeset</code> to sort edges, here's the code:</p>

<pre><code>TreeSet&lt;Edge&gt; edges = new TreeSet&lt;Edge&gt;();

//Sample problem - replace these values with your problem set
edges.add(new Edge("0", "1", 2));
edges.add(new Edge("0", "3", 1));
edges.add(new Edge("1", "2", 3));
edges.add(new Edge("2", "3", 5));
edges.add(new Edge("2", "4", 7));
edges.add(new Edge("3", "4", 6));
edges.add(new Edge("4", "5", 4));

System.out.println("Graph");
KruskalEdges vv = new KruskalEdges();

for (Edge edge : edges) {
    System.out.println(edge);
    vv.insertEdge(edge);
}
</code></pre>

<p>I just want to take inputs from user instead of giving statically into <code>edges.add</code></p>
