Java 教程
Java 實例
以下實例演示了如何使用 retainAll () 方法來計算兩個數(shù)組的交集:
以上代碼運行輸出結(jié)果為:
array1 數(shù)組元素:[common1, common2, notcommon2] array2 數(shù)組元素:[common1, common2, notcommon, notcommon1] array2 & array1 數(shù)組交集為:[common1, common2]