只需使用Sets和removeAll方法,
Set missing = new HashSet(list1);
missing.removeAll(list2);
System.out.println("missing:" + missing);
Set extra = new HashSet(list2);
extra.removeAll(list1);
System.out.println("extra:" + extra);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6552 次 |
最近记录: |