Created
August 6, 2014 08:47
-
-
Save yeluolanyan/81fe9d67df588677c0b0 to your computer and use it in GitHub Desktop.
计算两个集合的差集
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//计算两个集合的差集 | |
public static List diff(List ls, List ls2) { | |
List list = new ArrayList(Arrays.asList(new Object[ls.size()])); | |
Collections.copy(list, ls); | |
list.removeAll(ls2); | |
return list; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment