public static void main(String[] args) { String[] s1 = {"1","2","3","4"}; String[] s2 = {"3","4","5","6"}; TreeSet ts1 = new TreeSet(Arrays.asList(s1)); ts1.removeAll(Arrays.asList(s2)); System.out.println(ts1); }
输出:
[1, 2]
public static void main(String[] args) { String[] s1 = {"1","2","3","4"}; String[] s2 = {"3","4","5","6"}; TreeSet ts1 = new TreeSet(Arrays.asList(s1)); ts1.removeAll(Arrays.asList(s2)); System.out.println(ts1); }
输出:
[1, 2]