List 的 removeAll 方法的效率

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()差别不大。源代码如下:

 

[html] view plain copy
 
  1. public List<T> removeAll_01(List<T> source, List<T> destination) {  
  2.     List<Tresult = new LinkedList<T>();  
  3.     for(T t : source) {  
  4.         if (!destination.contains(t)) {  
  5.             result.add(t);  
  6.         }  
  7.     }  
  8.     return result;  
  9. }  

 

思路二:运用Set可以去重这一特性。将source中的元素逐个添加到由destination生成的Set中,如果Set.add(e)为true,说明e应该保留到结果中,否则放弃e。因为source中可能存在重复的元素,因此想到用Map来保存source中的元素与其在source中出现的次数。结果令我大跌眼镜,太JB帅了。性能的提高有好几个数量级。源代码如下:

 

[html] view plain copy
 
  1. public List<T> removeAll_02(List<T> source, List<T> destination) {  
  2.     List<Tresult = new LinkedList<T>();  
  3.   
  4.     Map<T, IntegersourceMap = new HashMap<T, Integer>();  
  5.     for (T t : source) {  
  6.         if (sourceMap.containsKey(t)) {  
  7.             sourceMap.put(t, sourceMap.get(t) + 1);  
  8.         } else {  
  9.             sourceMap.put(t, 1);  
  10.         }  
  11.     }  
  12.   
  13.     Set<Tall = new HashSet<T>(destination);  
  14.     for (Map.Entry<T, Integer> entry : sourceMap.entrySet()) {  
  15.         T key = entry.getKey();  
  16.         Integer value = entry.getValue();  
  17.         if (all.add(key)) {  
  18.             for (int i = 0; i value; i++) {  
  19.                 result.add(key);  
  20.             }  
  21.         }  
  22.     }  
  23.     return result;  
  24. }  

 

 

思路三:比较下思路二和思路一的代码实现,思路二优于思路一?为什么,为什么?难道Map.containsKey()方法要比List.contains()方法快几何倍数。所以有了思路三。因为Map.containsKey()实际就是Set.contains(),所以对思路一的代码做了少许修改。证实了想法,结果比思路二更好。源代码如下:

 

[html] view plain copy
 
  1. public List<T> removeAll_03(List<T> source, List<T> destination) {  
  2.     List<Tresult = new LinkedList<T>();  
  3.     Set<TdestinationSet = new HashSet<T>(destination);  
  4.     for(T t : source) {  
  5.         if (!destinationSet.contains(t)) {  
  6.             result.add(t);  
  7.         }  
  8.     }  
  9.     return result;  
  10. }  

 

那么,让我没看看具体的下效果如何。为了方便测试,T选用Integer,List中的元素用随机数Random.nextInt(),随机数的最大之为1,000,000。

上述结果表明,随着数据量的变大,思路二和思路三的表现非常出色。为什么会这样呢?归根到底,还是因为Map.containsKey()和Set.contains()的速度快。

好了,这个问题到此先告一段落。之后,再分析下各思路的算法和时间复杂度。

大家可以到http://download.csdn.net/detail/kangxingang/5549289下载完整代码,修改count和maxNumber后,查看执行结果。

"F:\Program Files\Java\jdk1.8.0_91\bin\java" -ea -Djacoco-agent.destfile=target/jacoco.exec -Didea.test.cyclic.buffer.size=1048576 "-javaagent:F:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2\lib\idea_rt.jar=55659:F:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2\bin" -Dfile.encoding=UTF-8 -classpath "F:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2\lib\idea_rt.jar;F:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2\plugins\junit\lib\junit-rt.jar;F:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2017.2\plugins\junit\lib\junit5-rt.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\charsets.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\deploy.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\access-bridge-64.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\cldrdata.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\dnsns.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\jaccess.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\jfxrt.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\localedata.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\nashorn.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunec.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunjce_provider.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunmscapi.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunpkcs11.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\zipfs.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\javaws.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\jce.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\jfr.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\jfxswt.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\jsse.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\management-agent.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\plugin.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\resources.jar;F:\Program Files\Java\jdk1.8.0_91\jre\lib\rt.jar;F:\git\ai\WALL-E-Server\target\test-classes;F:\git\ai\WALL-E-Server\target\classes;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter-web\1.5.4.RELEASE\spring-boot-starter-web-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter\1.5.4.RELEASE\spring-boot-starter-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot\1.5.4.RELEASE\spring-boot-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-autoconfigure\1.5.4.RELEASE\spring-boot-autoconfigure-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter-logging\1.5.4.RELEASE\spring-boot-starter-logging-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\ch\qos\logback\logback-classic\1.1.11\logback-classic-1.1.11.jar;C:\Users\z00199662\.m2\package2\org\slf4j\jul-to-slf4j\1.7.25\jul-to-slf4j-1.7.25.jar;C:\Users\z00199662\.m2\package2\org\slf4j\log4j-over-slf4j\1.7.25\log4j-over-slf4j-1.7.25.jar;C:\Users\z00199662\.m2\package2\org\yaml\snakeyaml\1.17\snakeyaml-1.17.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter-tomcat\1.5.4.RELEASE\spring-boot-starter-tomcat-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\apache\tomcat\embed\tomcat-embed-core\8.5.23\tomcat-embed-core-8.5.23.jar;C:\Users\z00199662\.m2\package2\org\apache\tomcat\tomcat-annotations-api\8.5.23\tomcat-annotations-api-8.5.23.jar;C:\Users\z00199662\.m2\package2\org\apache\tomcat\embed\tomcat-embed-el\8.5.23\tomcat-embed-el-8.5.23.jar;C:\Users\z00199662\.m2\package2\org\apache\tomcat\embed\tomcat-embed-websocket\8.5.23\tomcat-embed-websocket-8.5.23.jar;C:\Users\z00199662\.m2\package2\org\hibernate\hibernate-validator\5.3.5.Final\hibernate-validator-5.3.5.Final.jar;C:\Users\z00199662\.m2\package2\javax\validation\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;C:\Users\z00199662\.m2\package2\org\jboss\logging\jboss-logging\3.3.1.Final\jboss-logging-3.3.1.Final.jar;C:\Users\z00199662\.m2\package2\com\fasterxml\jackson\core\jackson-databind\2.8.8\jackson-databind-2.8.8.jar;C:\Users\z00199662\.m2\package2\com\fasterxml\jackson\core\jackson-annotations\2.8.0\jackson-annotations-2.8.0.jar;C:\Users\z00199662\.m2\package2\com\fasterxml\jackson\core\jackson-core\2.8.8\jackson-core-2.8.8.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-web\4.3.9.RELEASE\spring-web-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-webmvc\4.3.9.RELEASE\spring-webmvc-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter-data-jpa\1.5.4.RELEASE\spring-boot-starter-data-jpa-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter-jdbc\1.5.4.RELEASE\spring-boot-starter-jdbc-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\apache\tomcat\tomcat-jdbc\8.5.23\tomcat-jdbc-8.5.23.jar;C:\Users\z00199662\.m2\package2\org\apache\tomcat\tomcat-juli\8.5.23\tomcat-juli-8.5.23.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-jdbc\4.3.9.RELEASE\spring-jdbc-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\hibernate\hibernate-core\5.0.12.Final\hibernate-core-5.0.12.Final.jar;C:\Users\z00199662\.m2\package2\org\hibernate\javax\persistence\hibernate-jpa-2.1-api\1.0.0.Final\hibernate-jpa-2.1-api-1.0.0.Final.jar;C:\Users\z00199662\.m2\package2\org\javassist\javassist\3.21.0-GA\javassist-3.21.0-GA.jar;C:\Users\z00199662\.m2\package2\antlr\antlr\2.7.7\antlr-2.7.7.jar;C:\Users\z00199662\.m2\package2\org\jboss\jandex\2.0.0.Final\jandex-2.0.0.Final.jar;C:\Users\z00199662\.m2\package2\org\hibernate\common\hibernate-commons-annotations\5.0.1.Final\hibernate-commons-annotations-5.0.1.Final.jar;C:\Users\z00199662\.m2\package2\org\hibernate\hibernate-entitymanager\5.0.12.Final\hibernate-entitymanager-5.0.12.Final.jar;C:\Users\z00199662\.m2\package2\javax\transaction\javax.transaction-api\1.2\javax.transaction-api-1.2.jar;C:\Users\z00199662\.m2\package2\org\springframework\data\spring-data-jpa\1.11.4.RELEASE\spring-data-jpa-1.11.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\data\spring-data-commons\1.13.4.RELEASE\spring-data-commons-1.13.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-orm\4.3.9.RELEASE\spring-orm-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-tx\4.3.9.RELEASE\spring-tx-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\slf4j\jcl-over-slf4j\1.7.25\jcl-over-slf4j-1.7.25.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-aspects\4.3.9.RELEASE\spring-aspects-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter-data-redis\1.5.4.RELEASE\spring-boot-starter-data-redis-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\data\spring-data-redis\1.8.4.RELEASE\spring-data-redis-1.8.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\data\spring-data-keyvalue\1.2.4.RELEASE\spring-data-keyvalue-1.2.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-oxm\4.3.9.RELEASE\spring-oxm-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-context-support\4.3.9.RELEASE\spring-context-support-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\redis\clients\jedis\2.9.0\jedis-2.9.0.jar;C:\Users\z00199662\.m2\package2\org\apache\commons\commons-pool2\2.4.2\commons-pool2-2.4.2.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter-aop\1.5.4.RELEASE\spring-boot-starter-aop-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-aop\4.3.9.RELEASE\spring-aop-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\aspectj\aspectjweaver\1.8.10\aspectjweaver-1.8.10.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter-websocket\1.5.4.RELEASE\spring-boot-starter-websocket-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-messaging\4.3.9.RELEASE\spring-messaging-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-websocket\4.3.9.RELEASE\spring-websocket-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\projectlombok\lombok\1.16.18\lombok-1.16.18.jar;C:\Users\z00199662\.m2\package2\org\apache\httpcomponents\httpclient\4.5.2\httpclient-4.5.2.jar;C:\Users\z00199662\.m2\package2\org\apache\httpcomponents\httpcore\4.4.6\httpcore-4.4.6.jar;C:\Users\z00199662\.m2\package2\commons-codec\commons-codec\1.10\commons-codec-1.10.jar;C:\Users\z00199662\.m2\package2\org\apache\poi\poi\3.14\poi-3.14.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\proton\8.3-606.jdbc4\proton-8.3-606.jdbc4.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-starter-test\1.5.4.RELEASE\spring-boot-starter-test-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-test\1.5.4.RELEASE\spring-boot-test-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\boot\spring-boot-test-autoconfigure\1.5.4.RELEASE\spring-boot-test-autoconfigure-1.5.4.RELEASE.jar;C:\Users\z00199662\.m2\package2\com\jayway\jsonpath\json-path\2.2.0\json-path-2.2.0.jar;C:\Users\z00199662\.m2\package2\net\minidev\json-smart\2.2.1\json-smart-2.2.1.jar;C:\Users\z00199662\.m2\package2\net\minidev\accessors-smart\1.1\accessors-smart-1.1.jar;C:\Users\z00199662\.m2\package2\org\ow2\asm\asm\5.0.3\asm-5.0.3.jar;C:\Users\z00199662\.m2\package2\junit\junit\4.12\junit-4.12.jar;C:\Users\z00199662\.m2\package2\org\assertj\assertj-core\2.6.0\assertj-core-2.6.0.jar;C:\Users\z00199662\.m2\package2\org\mockito\mockito-core\1.10.19\mockito-core-1.10.19.jar;C:\Users\z00199662\.m2\package2\org\objenesis\objenesis\2.1\objenesis-2.1.jar;C:\Users\z00199662\.m2\package2\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar;C:\Users\z00199662\.m2\package2\org\hamcrest\hamcrest-library\1.3\hamcrest-library-1.3.jar;C:\Users\z00199662\.m2\package2\org\skyscreamer\jsonassert\1.4.0\jsonassert-1.4.0.jar;C:\Users\z00199662\.m2\package2\com\vaadin\external\google\android-json\0.0.20131108.vaadin1\android-json-0.0.20131108.vaadin1.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-core\4.3.9.RELEASE\spring-core-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-test\4.3.9.RELEASE\spring-test-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\com\alibaba\fastjson\1.2.37\fastjson-1.2.37.jar;C:\Users\z00199662\.m2\package2\org\jacoco\org.jacoco.agent\0.7.9\org.jacoco.agent-0.7.9-runtime.jar;C:\Users\z00199662\.m2\package2\io\springfox\springfox-swagger2\2.6.1\springfox-swagger2-2.6.1.jar;C:\Users\z00199662\.m2\package2\io\swagger\swagger-annotations\1.5.10\swagger-annotations-1.5.10.jar;C:\Users\z00199662\.m2\package2\io\swagger\swagger-models\1.5.10\swagger-models-1.5.10.jar;C:\Users\z00199662\.m2\package2\io\springfox\springfox-spi\2.6.1\springfox-spi-2.6.1.jar;C:\Users\z00199662\.m2\package2\io\springfox\springfox-core\2.6.1\springfox-core-2.6.1.jar;C:\Users\z00199662\.m2\package2\io\springfox\springfox-schema\2.6.1\springfox-schema-2.6.1.jar;C:\Users\z00199662\.m2\package2\io\springfox\springfox-swagger-common\2.6.1\springfox-swagger-common-2.6.1.jar;C:\Users\z00199662\.m2\package2\io\springfox\springfox-spring-web\2.6.1\springfox-spring-web-2.6.1.jar;C:\Users\z00199662\.m2\package2\com\google\guava\guava\18.0\guava-18.0.jar;C:\Users\z00199662\.m2\package2\com\fasterxml\classmate\1.3.3\classmate-1.3.3.jar;C:\Users\z00199662\.m2\package2\org\slf4j\slf4j-api\1.7.25\slf4j-api-1.7.25.jar;C:\Users\z00199662\.m2\package2\org\springframework\plugin\spring-plugin-core\1.2.0.RELEASE\spring-plugin-core-1.2.0.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\plugin\spring-plugin-metadata\1.2.0.RELEASE\spring-plugin-metadata-1.2.0.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\mapstruct\mapstruct\1.0.0.Final\mapstruct-1.0.0.Final.jar;C:\Users\z00199662\.m2\package2\io\springfox\springfox-swagger-ui\2.6.1\springfox-swagger-ui-2.6.1.jar;C:\Users\z00199662\.m2\package2\com\huawei\wsf\huawei-secure-core\2.1.4\huawei-secure-core-2.1.4.jar;C:\Users\z00199662\.m2\package2\org\springframework\security\spring-security-core\4.2.3.RELEASE\spring-security-core-4.2.3.RELEASE.jar;C:\Users\z00199662\.m2\package2\aopalliance\aopalliance\1.0\aopalliance-1.0.jar;C:\Users\z00199662\.m2\package2\org\springframework\security\spring-security-web\4.2.3.RELEASE\spring-security-web-4.2.3.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-beans\4.3.9.RELEASE\spring-beans-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-context\4.3.9.RELEASE\spring-context-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\org\springframework\spring-expression\4.3.9.RELEASE\spring-expression-4.3.9.RELEASE.jar;C:\Users\z00199662\.m2\package2\com\huawei\wsf\huawei-secure-validator\2.1.4\huawei-secure-validator-2.1.4.jar;C:\Users\z00199662\.m2\package2\com\huawei\wsf\huawei-secure-checkengine\2.0.4\huawei-secure-checkengine-2.0.4.jar;C:\Users\z00199662\.m2\package2\dom4j\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Users\z00199662\.m2\package2\jaxen\jaxen\1.1.6\jaxen-1.1.6.jar;C:\Users\z00199662\.m2\package2\com\huawei\wsf\huawei-secure-api\2.1.4\huawei-secure-api-2.1.4.jar;C:\Users\z00199662\.m2\package2\log4j\log4j\1.2.16\log4j-1.2.16.jar;C:\Users\z00199662\.m2\package2\org\owasp\antisamy\antisamy\1.5.7\antisamy-1.5.7.jar;C:\Users\z00199662\.m2\package2\commons-lang\commons-lang\2.6\commons-lang-2.6.jar;C:\Users\z00199662\.m2\package2\com\huawei\pdm\org\apache\xmlgraphics\batik-css\1.9\batik-css-1.9.jar;C:\Users\z00199662\.m2\package2\net\sourceforge\nekohtml\nekohtml\1.9.22\nekohtml-1.9.22.jar;C:\Users\z00199662\.m2\package2\apache-xerces\xercesImpl\2.9.1\xercesImpl-2.9.1.jar;C:\Users\z00199662\.m2\package2\net\logstash\logback\logstash-logback-encoder\4.9\logstash-logback-encoder-4.9.jar;C:\Users\z00199662\.m2\package2\ch\qos\logback\logback-core\1.1.11\logback-core-1.1.11.jar;C:\Users\z00199662\.m2\package2\commons-configuration\commons-configuration\1.8\commons-configuration-1.8.jar;C:\Users\z00199662\.m2\package2\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar;C:\Users\z00199662\.m2\package2\com\squareup\okhttp3\okhttp\3.5.0\okhttp-3.5.0.jar;C:\Users\z00199662\.m2\package2\com\squareup\okio\okio\1.11.0\okio-1.11.0.jar;C:\Users\z00199662\.m2\package2\com\huawei\aigateway\base-agent\0.0.1-SNAPSHOT\base-agent-0.0.1-20180419.172826-462.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\httpcore\4.4.5\httpcore-4.4.5.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\mina-core\2.0.16\mina-core-2.0.16.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\dom4j\1.6.1\dom4j-1.6.1.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\jackson-all\1.9.11\jackson-all-1.9.11.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\slf4j-api\1.7.21\slf4j-api-1.7.21.jar;C:\Users\z00199662\.m2\package2\com\huawei\aigateway\base-mml\0.0.1-SNAPSHOT\base-mml-0.0.1-20180419.172831-461.jar;C:\Users\z00199662\.m2\package2\com\huawei\aigateway\common\0.0.1-SNAPSHOT\common-0.0.1-20180419.172819-465.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\commons-lang3\3.2\commons-lang3-3.2.jar;C:\Users\z00199662\.m2\package2\com\huawei\aigateway\utils\0.0.1-SNAPSHOT\utils-0.0.1-20180419.172816-466.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\xpp3\1.1.4\xpp3-1.1.4-c.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\commons-io\2.4\commons-io-2.4.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\axis2-adb\1.6.3\axis2-adb-1.6.3.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\validation-api\1.1.0.Final\validation-api-1.1.0.Final.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\jersey-server\2.23.1\jersey-server-2.23.1.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\com.springsource.org.apache.commons.lang\2.6.0\com.springsource.org.apache.commons.lang-2.6.0.jar;C:\Users\z00199662\.m2\package2\com\huawei\aigateway\base-snmp\0.0.1-SNAPSHOT\base-snmp-0.0.1-20180419.172834-204.jar;C:\Users\z00199662\.m2\package2\temp2\uportal\3rd\snmp4j\2.2.2\snmp4j-2.2.2.jar;C:\Users\z00199662\.m2\package2\com\github\penggle\kaptcha\2.3.2\kaptcha-2.3.2.jar;C:\Users\z00199662\.m2\package2\javax\servlet\javax.servlet-api\3.1.0\javax.servlet-api-3.1.0.jar;C:\Users\z00199662\.m2\package2\com\jhlabs\filters\2.0.235-1\filters-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

posted @ 2018-04-24 16:02  傲衣华少  阅读(1199)  评论(0编辑  收藏  举报