apache / incubator-hugegraph-commons

(Archived Warning)Please visit "apache/hugegraph" repo instead
https://github.com/apache/hugegraph/tree/master/hugegraph-commons
Apache License 2.0
29 stars 45 forks source link

optimize CollectionUtils.intersection() #2

Closed Linary closed 6 years ago

Linary commented 6 years ago

hugegraph-issue-83 Since the apache CollectionUtils.intersection() is based on copy and element count statistics, most of the time, we can change the original set without having to reconstruct the set and copy. So we provide an optimized method based on retainAll(). Also add hasIntersection(set1, set2) for CollectionUtils.intersection(set1, set2).isEmpty()