List 的 removeAll 方法的效率低的原因: 要遍历source,对dest进行contain操作,而contain又要遍历dest进行equal比较。
解决办法:dest转为set,用set的contain方法,然后不包含的add到新的list。add的效率更高。
代码:
public static <T> List<T> removeAll(final List<T> source, final List<T> destination) {
List<T> result = new ArrayList<>();
Set<T> destinationSet = new HashSet<T>(destination);
for(T t : source) {
if (!destinationSet.contains(t)) {
result.add(t);
}
}
return result;
}
实测:
ArrayList.removeAll: source size is 100, final size is 80, use millis is 0
ListUtil.removeAll: source size is 100, final size is 80, use millis is 2
ArrayList.removeAll: source size is 1000, final size is 800, use millis is 4
ListUtil.removeAll: source size is 1000, final size is 800, use millis is 1
ArrayList.removeAll: source size is 10000, final size is 8000, use millis is 120
ListUtil.removeAll: source size is 10000, final size is 8000, use millis is 3
ArrayList.removeAll: source size is 100000, final size is 80000, use millis is 14424
ListUtil.removeAll: source size is 100000, final size is 80000, use millis is 29
ListUtil.removeAll: source size is 1000000, final size is 800000, use millis is 121
ListUtil.removeAll: source size is 10000000, final size is 8000000, use millis is 2277
下文转自:https://blog.csdn.net/kangxingang/article/details/9033491
原文内容:
Java中,List是最常用到的一种集合类。我们也经常对List进行操作,也没有碰到什么问题。但是刚刚在调用removeAll方法是,碰到了严重的性能问题。
问题是这样的:
原集合:List<T> source,有大概200,000数据。
目标集合:List<T> destination,有大概150,000数据。
两者中都可能有重复的元素,两者中可能有相同的元素。已经实现了T中的hashCode(),equals()方法。我调用了source.removeAll(destination),结果花费了15分钟时间。这真是不可接受的。
下来就是自己瞎折腾,试图实现一个与removeAll()方法功能一样的方法,但是性能要有提高。
思路一:有资料表明,给List中add()数据的速度要比从List中remove()数据的快。试着实现了下,但是效果不明显,与原来的removeAll()差别不大。源代码如下:
- public List<T> removeAll_01(List<T> source, List<T> destination) {
- List<T> result = new LinkedList<T>();
- for(T t : source) {
- if (!destination.contains(t)) {
- result.add(t);
- }
- }
- return result;
- }
思路二:运用Set可以去重这一特性。将source中的元素逐个添加到由destination生成的Set中,如果Set.add(e)为true,说明e应该保留到结果中,否则放弃e。因为source中可能存在重复的元素,因此想到用Map来保存source中的元素与其在source中出现的次数。结果令我大跌眼镜,太JB帅了。性能的提高有好几个数量级。源代码如下:
- public List<T> removeAll_02(List<T> source, List<T> destination) {
- List<T> result = new LinkedList<T>();
- Map<T, Integer> sourceMap = new HashMap<T, Integer>();
- for (T t : source) {
- if (sourceMap.containsKey(t)) {
- sourceMap.put(t, sourceMap.get(t) + 1);
- } else {
- sourceMap.put(t, 1);
- }
- }
- Set<T> all = new HashSet<T>(destination);
- for (Map.Entry<T, Integer> entry : sourceMap.entrySet()) {
- T key = entry.getKey();
- Integer value = entry.getValue();
- if (all.add(key)) {
- for (int i = 0; i < value; i++) {
- result.add(key);
- }
- }
- }
- return result;
- }
思路三:比较下思路二和思路一的代码实现,思路二优于思路一?为什么,为什么?难道Map.containsKey()方法要比List.contains()方法快几何倍数。所以有了思路三。因为Map.containsKey()实际就是Set.contains(),所以对思路一的代码做了少许修改。证实了想法,结果比思路二更好。源代码如下:
- public List<T> removeAll_03(List<T> source, List<T> destination) {
- List<T> result = new LinkedList<T>();
- Set<T> destinationSet = new HashSet<T>(destination);
- for(T t : source) {
- if (!destinationSet.contains(t)) {
- result.add(t);
- }
- }
- return result;
- }
那么,让我没看看具体的下效果如何。为了方便测试,T选用Integer,List中的元素用随机数Random.nextInt(),随机数的最大之为1,000,000。
上述结果表明,随着数据量的变大,思路二和思路三的表现非常出色。为什么会这样呢?归根到底,还是因为Map.containsKey()和Set.contains()的速度快。
好了,这个问题到此先告一段落。之后,再分析下各思路的算法和时间复杂度。
大家可以到http://download.csdn.net/detail/kangxingang/5549289下载完整代码,修改count和maxNumber后,查看执行结果。
"F:Program FilesJavajdk1.8.0_91injava" -ea -Djacoco-agent.destfile=target/jacoco.exec -Didea.test.cyclic.buffer.size=1048576 "-javaagent:F:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2libidea_rt.jar=55659:F:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2in" -Dfile.encoding=UTF-8 -classpath "F:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2libidea_rt.jar;F:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2pluginsjunitlibjunit-rt.jar;F:Program FilesJetBrainsIntelliJ IDEA Community Edition 2017.2pluginsjunitlibjunit5-rt.jar;F:Program FilesJavajdk1.8.0_91jrelibcharsets.jar;F:Program FilesJavajdk1.8.0_91jrelibdeploy.jar;F:Program FilesJavajdk1.8.0_91jrelibextaccess-bridge-64.jar;F:Program FilesJavajdk1.8.0_91jrelibextcldrdata.jar;F:Program FilesJavajdk1.8.0_91jrelibextdnsns.jar;F:Program FilesJavajdk1.8.0_91jrelibextjaccess.jar;F:Program FilesJavajdk1.8.0_91jrelibextjfxrt.jar;F:Program FilesJavajdk1.8.0_91jrelibextlocaledata.jar;F:Program FilesJavajdk1.8.0_91jrelibext
ashorn.jar;F:Program FilesJavajdk1.8.0_91jrelibextsunec.jar;F:Program FilesJavajdk1.8.0_91jrelibextsunjce_provider.jar;F:Program FilesJavajdk1.8.0_91jrelibextsunmscapi.jar;F:Program FilesJavajdk1.8.0_91jrelibextsunpkcs11.jar;F:Program FilesJavajdk1.8.0_91jrelibextzipfs.jar;F:Program FilesJavajdk1.8.0_91jrelibjavaws.jar;F:Program FilesJavajdk1.8.0_91jrelibjce.jar;F:Program FilesJavajdk1.8.0_91jrelibjfr.jar;F:Program FilesJavajdk1.8.0_91jrelibjfxswt.jar;F:Program FilesJavajdk1.8.0_91jrelibjsse.jar;F:Program FilesJavajdk1.8.0_91jrelibmanagement-agent.jar;F:Program FilesJavajdk1.8.0_91jrelibplugin.jar;F:Program FilesJavajdk1.8.0_91jrelib
esources.jar;F:Program FilesJavajdk1.8.0_91jrelib
t.jar;F:gitaiWALL-E-Server arget est-classes;F:gitaiWALL-E-Server argetclasses;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter-web1.5.4.RELEASEspring-boot-starter-web-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter1.5.4.RELEASEspring-boot-starter-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot1.5.4.RELEASEspring-boot-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-autoconfigure1.5.4.RELEASEspring-boot-autoconfigure-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter-logging1.5.4.RELEASEspring-boot-starter-logging-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2chqoslogbacklogback-classic1.1.11logback-classic-1.1.11.jar;C:Usersz00199662.m2package2orgslf4jjul-to-slf4j1.7.25jul-to-slf4j-1.7.25.jar;C:Usersz00199662.m2package2orgslf4jlog4j-over-slf4j1.7.25log4j-over-slf4j-1.7.25.jar;C:Usersz00199662.m2package2orgyamlsnakeyaml1.17snakeyaml-1.17.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter-tomcat1.5.4.RELEASEspring-boot-starter-tomcat-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgapache omcatembed omcat-embed-core8.5.23 omcat-embed-core-8.5.23.jar;C:Usersz00199662.m2package2orgapache omcat omcat-annotations-api8.5.23 omcat-annotations-api-8.5.23.jar;C:Usersz00199662.m2package2orgapache omcatembed omcat-embed-el8.5.23 omcat-embed-el-8.5.23.jar;C:Usersz00199662.m2package2orgapache omcatembed omcat-embed-websocket8.5.23 omcat-embed-websocket-8.5.23.jar;C:Usersz00199662.m2package2orghibernatehibernate-validator5.3.5.Finalhibernate-validator-5.3.5.Final.jar;C:Usersz00199662.m2package2javaxvalidationvalidation-api1.1.0.Finalvalidation-api-1.1.0.Final.jar;C:Usersz00199662.m2package2orgjbossloggingjboss-logging3.3.1.Finaljboss-logging-3.3.1.Final.jar;C:Usersz00199662.m2package2comfasterxmljacksoncorejackson-databind2.8.8jackson-databind-2.8.8.jar;C:Usersz00199662.m2package2comfasterxmljacksoncorejackson-annotations2.8.0jackson-annotations-2.8.0.jar;C:Usersz00199662.m2package2comfasterxmljacksoncorejackson-core2.8.8jackson-core-2.8.8.jar;C:Usersz00199662.m2package2orgspringframeworkspring-web4.3.9.RELEASEspring-web-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-webmvc4.3.9.RELEASEspring-webmvc-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter-data-jpa1.5.4.RELEASEspring-boot-starter-data-jpa-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter-jdbc1.5.4.RELEASEspring-boot-starter-jdbc-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgapache omcat omcat-jdbc8.5.23 omcat-jdbc-8.5.23.jar;C:Usersz00199662.m2package2orgapache omcat omcat-juli8.5.23 omcat-juli-8.5.23.jar;C:Usersz00199662.m2package2orgspringframeworkspring-jdbc4.3.9.RELEASEspring-jdbc-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orghibernatehibernate-core5.0.12.Finalhibernate-core-5.0.12.Final.jar;C:Usersz00199662.m2package2orghibernatejavaxpersistencehibernate-jpa-2.1-api1.0.0.Finalhibernate-jpa-2.1-api-1.0.0.Final.jar;C:Usersz00199662.m2package2orgjavassistjavassist3.21.0-GAjavassist-3.21.0-GA.jar;C:Usersz00199662.m2package2antlrantlr2.7.7antlr-2.7.7.jar;C:Usersz00199662.m2package2orgjbossjandex2.0.0.Finaljandex-2.0.0.Final.jar;C:Usersz00199662.m2package2orghibernatecommonhibernate-commons-annotations5.0.1.Finalhibernate-commons-annotations-5.0.1.Final.jar;C:Usersz00199662.m2package2orghibernatehibernate-entitymanager5.0.12.Finalhibernate-entitymanager-5.0.12.Final.jar;C:Usersz00199662.m2package2javax ransactionjavax.transaction-api1.2javax.transaction-api-1.2.jar;C:Usersz00199662.m2package2orgspringframeworkdataspring-data-jpa1.11.4.RELEASEspring-data-jpa-1.11.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkdataspring-data-commons1.13.4.RELEASEspring-data-commons-1.13.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-orm4.3.9.RELEASEspring-orm-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-tx4.3.9.RELEASEspring-tx-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgslf4jjcl-over-slf4j1.7.25jcl-over-slf4j-1.7.25.jar;C:Usersz00199662.m2package2orgspringframeworkspring-aspects4.3.9.RELEASEspring-aspects-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter-data-redis1.5.4.RELEASEspring-boot-starter-data-redis-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkdataspring-data-redis1.8.4.RELEASEspring-data-redis-1.8.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkdataspring-data-keyvalue1.2.4.RELEASEspring-data-keyvalue-1.2.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-oxm4.3.9.RELEASEspring-oxm-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-context-support4.3.9.RELEASEspring-context-support-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2
edisclientsjedis2.9.0jedis-2.9.0.jar;C:Usersz00199662.m2package2orgapachecommonscommons-pool22.4.2commons-pool2-2.4.2.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter-aop1.5.4.RELEASEspring-boot-starter-aop-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-aop4.3.9.RELEASEspring-aop-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgaspectjaspectjweaver1.8.10aspectjweaver-1.8.10.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter-websocket1.5.4.RELEASEspring-boot-starter-websocket-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-messaging4.3.9.RELEASEspring-messaging-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-websocket4.3.9.RELEASEspring-websocket-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgprojectlomboklombok1.16.18lombok-1.16.18.jar;C:Usersz00199662.m2package2orgapachehttpcomponentshttpclient4.5.2httpclient-4.5.2.jar;C:Usersz00199662.m2package2orgapachehttpcomponentshttpcore4.4.6httpcore-4.4.6.jar;C:Usersz00199662.m2package2commons-codeccommons-codec1.10commons-codec-1.10.jar;C:Usersz00199662.m2package2orgapachepoipoi3.14poi-3.14.jar;C:Usersz00199662.m2package2 emp2uportal3rdproton8.3-606.jdbc4proton-8.3-606.jdbc4.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-starter-test1.5.4.RELEASEspring-boot-starter-test-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-test1.5.4.RELEASEspring-boot-test-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkootspring-boot-test-autoconfigure1.5.4.RELEASEspring-boot-test-autoconfigure-1.5.4.RELEASE.jar;C:Usersz00199662.m2package2comjaywayjsonpathjson-path2.2.0json-path-2.2.0.jar;C:Usersz00199662.m2package2
etminidevjson-smart2.2.1json-smart-2.2.1.jar;C:Usersz00199662.m2package2
etminidevaccessors-smart1.1accessors-smart-1.1.jar;C:Usersz00199662.m2package2orgow2asmasm5.0.3asm-5.0.3.jar;C:Usersz00199662.m2package2junitjunit4.12junit-4.12.jar;C:Usersz00199662.m2package2orgassertjassertj-core2.6.0assertj-core-2.6.0.jar;C:Usersz00199662.m2package2orgmockitomockito-core1.10.19mockito-core-1.10.19.jar;C:Usersz00199662.m2package2orgobjenesisobjenesis2.1objenesis-2.1.jar;C:Usersz00199662.m2package2orghamcresthamcrest-core1.3hamcrest-core-1.3.jar;C:Usersz00199662.m2package2orghamcresthamcrest-library1.3hamcrest-library-1.3.jar;C:Usersz00199662.m2package2orgskyscreamerjsonassert1.4.0jsonassert-1.4.0.jar;C:Usersz00199662.m2package2comvaadinexternalgoogleandroid-json .0.20131108.vaadin1android-json-0.0.20131108.vaadin1.jar;C:Usersz00199662.m2package2orgspringframeworkspring-core4.3.9.RELEASEspring-core-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-test4.3.9.RELEASEspring-test-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2comalibabafastjson1.2.37fastjson-1.2.37.jar;C:Usersz00199662.m2package2orgjacocoorg.jacoco.agent .7.9org.jacoco.agent-0.7.9-runtime.jar;C:Usersz00199662.m2package2iospringfoxspringfox-swagger22.6.1springfox-swagger2-2.6.1.jar;C:Usersz00199662.m2package2ioswaggerswagger-annotations1.5.10swagger-annotations-1.5.10.jar;C:Usersz00199662.m2package2ioswaggerswagger-models1.5.10swagger-models-1.5.10.jar;C:Usersz00199662.m2package2iospringfoxspringfox-spi2.6.1springfox-spi-2.6.1.jar;C:Usersz00199662.m2package2iospringfoxspringfox-core2.6.1springfox-core-2.6.1.jar;C:Usersz00199662.m2package2iospringfoxspringfox-schema2.6.1springfox-schema-2.6.1.jar;C:Usersz00199662.m2package2iospringfoxspringfox-swagger-common2.6.1springfox-swagger-common-2.6.1.jar;C:Usersz00199662.m2package2iospringfoxspringfox-spring-web2.6.1springfox-spring-web-2.6.1.jar;C:Usersz00199662.m2package2comgoogleguavaguava18.0guava-18.0.jar;C:Usersz00199662.m2package2comfasterxmlclassmate1.3.3classmate-1.3.3.jar;C:Usersz00199662.m2package2orgslf4jslf4j-api1.7.25slf4j-api-1.7.25.jar;C:Usersz00199662.m2package2orgspringframeworkpluginspring-plugin-core1.2.0.RELEASEspring-plugin-core-1.2.0.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkpluginspring-plugin-metadata1.2.0.RELEASEspring-plugin-metadata-1.2.0.RELEASE.jar;C:Usersz00199662.m2package2orgmapstructmapstruct1.0.0.Finalmapstruct-1.0.0.Final.jar;C:Usersz00199662.m2package2iospringfoxspringfox-swagger-ui2.6.1springfox-swagger-ui-2.6.1.jar;C:Usersz00199662.m2package2comhuaweiwsfhuawei-secure-core2.1.4huawei-secure-core-2.1.4.jar;C:Usersz00199662.m2package2orgspringframeworksecurityspring-security-core4.2.3.RELEASEspring-security-core-4.2.3.RELEASE.jar;C:Usersz00199662.m2package2aopallianceaopalliance1.0aopalliance-1.0.jar;C:Usersz00199662.m2package2orgspringframeworksecurityspring-security-web4.2.3.RELEASEspring-security-web-4.2.3.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-beans4.3.9.RELEASEspring-beans-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-context4.3.9.RELEASEspring-context-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2orgspringframeworkspring-expression4.3.9.RELEASEspring-expression-4.3.9.RELEASE.jar;C:Usersz00199662.m2package2comhuaweiwsfhuawei-secure-validator2.1.4huawei-secure-validator-2.1.4.jar;C:Usersz00199662.m2package2comhuaweiwsfhuawei-secure-checkengine2.0.4huawei-secure-checkengine-2.0.4.jar;C:Usersz00199662.m2package2dom4jdom4j1.6.1dom4j-1.6.1.jar;C:Usersz00199662.m2package2jaxenjaxen1.1.6jaxen-1.1.6.jar;C:Usersz00199662.m2package2comhuaweiwsfhuawei-secure-api2.1.4huawei-secure-api-2.1.4.jar;C:Usersz00199662.m2package2log4jlog4j1.2.16log4j-1.2.16.jar;C:Usersz00199662.m2package2orgowaspantisamyantisamy1.5.7antisamy-1.5.7.jar;C:Usersz00199662.m2package2commons-langcommons-lang2.6commons-lang-2.6.jar;C:Usersz00199662.m2package2comhuaweipdmorgapachexmlgraphicsatik-css1.9atik-css-1.9.jar;C:Usersz00199662.m2package2
etsourceforge
ekohtml
ekohtml1.9.22
ekohtml-1.9.22.jar;C:Usersz00199662.m2package2apache-xercesxercesImpl2.9.1xercesImpl-2.9.1.jar;C:Usersz00199662.m2package2
etlogstashlogbacklogstash-logback-encoder4.9logstash-logback-encoder-4.9.jar;C:Usersz00199662.m2package2chqoslogbacklogback-core1.1.11logback-core-1.1.11.jar;C:Usersz00199662.m2package2commons-configurationcommons-configuration1.8commons-configuration-1.8.jar;C:Usersz00199662.m2package2commons-loggingcommons-logging1.1.1commons-logging-1.1.1.jar;C:Usersz00199662.m2package2comsquareupokhttp3okhttp3.5.0okhttp-3.5.0.jar;C:Usersz00199662.m2package2comsquareupokiookio1.11.0okio-1.11.0.jar;C:Usersz00199662.m2package2comhuaweiaigatewayase-agent .0.1-SNAPSHOTase-agent-0.0.1-20180419.172826-462.jar;C:Usersz00199662.m2package2 emp2uportal3rdhttpcore4.4.5httpcore-4.4.5.jar;C:Usersz00199662.m2package2 emp2uportal3rdmina-core2.0.16mina-core-2.0.16.jar;C:Usersz00199662.m2package2 emp2uportal3rddom4j1.6.1dom4j-1.6.1.jar;C:Usersz00199662.m2package2 emp2uportal3rdjackson-all1.9.11jackson-all-1.9.11.jar;C:Usersz00199662.m2package2 emp2uportal3rdslf4j-api1.7.21slf4j-api-1.7.21.jar;C:Usersz00199662.m2package2comhuaweiaigatewayase-mml .0.1-SNAPSHOTase-mml-0.0.1-20180419.172831-461.jar;C:Usersz00199662.m2package2comhuaweiaigatewaycommon .0.1-SNAPSHOTcommon-0.0.1-20180419.172819-465.jar;C:Usersz00199662.m2package2 emp2uportal3rdcommons-lang33.2commons-lang3-3.2.jar;C:Usersz00199662.m2package2comhuaweiaigatewayutils .0.1-SNAPSHOTutils-0.0.1-20180419.172816-466.jar;C:Usersz00199662.m2package2 emp2uportal3rdxpp31.1.4xpp3-1.1.4-c.jar;C:Usersz00199662.m2package2 emp2uportal3rdcommons-io2.4commons-io-2.4.jar;C:Usersz00199662.m2package2 emp2uportal3rdaxis2-adb1.6.3axis2-adb-1.6.3.jar;C:Usersz00199662.m2package2 emp2uportal3rdvalidation-api1.1.0.Finalvalidation-api-1.1.0.Final.jar;C:Usersz00199662.m2package2 emp2uportal3rdjersey-server2.23.1jersey-server-2.23.1.jar;C:Usersz00199662.m2package2 emp2uportal3rdcom.springsource.org.apache.commons.lang2.6.0com.springsource.org.apache.commons.lang-2.6.0.jar;C:Usersz00199662.m2package2comhuaweiaigatewayase-snmp .0.1-SNAPSHOTase-snmp-0.0.1-20180419.172834-204.jar;C:Usersz00199662.m2package2 emp2uportal3rdsnmp4j2.2.2snmp4j-2.2.2.jar;C:Usersz00199662.m2package2comgithubpengglekaptcha2.3.2kaptcha-2.3.2.jar;C:Usersz00199662.m2package2javaxservletjavax.servlet-api3.1.0javax.servlet-api-3.1.0.jar;C:Usersz00199662.m2package2comjhlabsfilters2.0.235-1filters-2.0.235-1.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.huawei.ai.common.util.ListUtilTest,listRemoveAllArrayList.removeAll: source size is 100, final size is 80, use millis is 0ListUtil.removeAll: source size is 100, final size is 80, use millis is 2
ArrayList.removeAll: source size is 1000, final size is 800, use millis is 4ListUtil.removeAll: source size is 1000, final size is 800, use millis is 1
ArrayList.removeAll: source size is 10000, final size is 8000, use millis is 120ListUtil.removeAll: source size is 10000, final size is 8000, use millis is 3
ArrayList.removeAll: source size is 100000, final size is 80000, use millis is 14424ListUtil.removeAll: source size is 100000, final size is 80000, use millis is 29
ListUtil.removeAll: source size is 1000000, final size is 800000, use millis is 121
ListUtil.removeAll: source size is 10000000, final size is 8000000, use millis is 2277