Skip to content

Instantly share code, notes, and snippets.

@yeluolanyan
Created August 6, 2014 08:47
Show Gist options
  • Save yeluolanyan/81fe9d67df588677c0b0 to your computer and use it in GitHub Desktop.
Save yeluolanyan/81fe9d67df588677c0b0 to your computer and use it in GitHub Desktop.
计算两个集合的差集
//计算两个集合的差集
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