标签:
import java.util.Iterator; import java.util.Scanner; import java.util.TreeSet; public class RandomDataSort { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num = scan.nextInt(); TreeSet<Integer> tSet = new TreeSet<Integer>(); while (num != 0) { tSet.add(scan.nextInt()); num--; } Iterator<Integer> it = tSet.iterator(); while (it.hasNext()) { System.out.println(it.next()); } } }
TreeSet的用法:
详情见:http://www.cnblogs.com/ningvsban/archive/2013/05/06/3062535.html
版权声明:本文为博主原创文章,未经博主允许不得转载。
标签:
原文地址:http://blog.csdn.net/liaction/article/details/47659723