import java.util.Iterator; import java.util.TreeSet; public class MainClass { public static void main(String[] argv) { TreeSet set = new TreeSet(); for (int i = 0; i < 3; i++) set.add(Math.random()); Iterator iter = set.iterator(); while (iter.hasNext()) System.out.println(iter.next()); } }
0.21972875445139584 0.27062139982567435 0.9615419196391383