(轉載我使用的是TreeSet,因為題目要求是集合
public static void test2() {
TreeSet
TreeSet
Random r = new Random();
for (int i = 0; i < 30; i++) {
(Int(30));
(Int(30));
}
inAll(b);
tln(a);
tln(b);
tln(a);
}
其中的'retainAll是JDK自帶的演算法,我們看一下源程式碼
public boolean retainAll(Collection