当前位置: 首页 > news >正文

百度调整导致网站排名下降全国网站排名

百度调整导致网站排名下降,全国网站排名,做家教网站的资源是什么,短剧小程序开发费用今天在偶然之间发现了一个bug#xff0c;原因居然是使用了containsAll()方法#xff0c;这个问题很简单#xff0c;看以下代码就能发现很大的问题。 package collection;import java.util.ArrayList; import java.util.List;/*** author heyunlin* version 1.0*/ public cl…今天在偶然之间发现了一个bug原因居然是使用了containsAll()方法这个问题很简单看以下代码就能发现很大的问题。 package collection;import java.util.ArrayList; import java.util.List;/*** author heyunlin* version 1.0*/ public class ListExample {public static void main(String[] args) {ListInteger list new ArrayList();list.add(2);list.add(3);list.add(3);ListInteger integerList new ArrayList();integerList.add(3);integerList.add(3);integerList.add(3);System.out.println(list);System.out.println(integerList);System.out.println(list.containsAll(integerList));}} 上面的结果最后一行打印的是true因为containsAll()方法的作用类似于遍历指定的集合c通过contains()比较集合中每个元素如果有元素不包含在当前的list对象中就返回false否则返回true为了便于理解写了以下伪代码 public interface ListE extends CollectionE {public boolean containsAll(Collection? c) {for (Object o : c) {if (!this.contains()) {return false;}}return true;}} 因此文章给出的代码等价于 package collection;import java.util.ArrayList; import java.util.List;/*** author heyunlin* version 1.0*/ public class ListExample {public static void main(String[] args) {ListInteger list new ArrayList();list.add(2);list.add(3);list.add(3);System.out.println(list);System.out.println(integerList);System.out.println(list.contains(3));}} 总结这篇文章分享了一下项目中遇到的关于containsAll()方法使用时应该考虑到的问题当比较的两个list中元素个数相同时可以用equals()方法替代containsAll()方法使用但是在使用之前需要对两个集合排序因为List的源码里已经说明了只有但集合元素的个数和顺序都一样才返回true。 /*** Compares the specified object with this list for equality. Returns* true if and only if the specified object is also a list, both* lists have the same size, and all corresponding pairs of elements in* the two lists are equal. (Two elements e1 and* e2 are equal if (e1null ? e2null :* e1.equals(e2)).) In other words, two lists are defined to be* equal if they contain the same elements in the same order. This* definition ensures that the equals method works properly across* different implementations of the List interface.** param o the object to be compared for equality with this list* return true if the specified object is equal to this list*/ boolean equals(Object o); 好了文章就分享到这里了感谢阅读~
http://www.zqtcl.cn/news/30967/

相关文章:

  • 网站开发专业术语大全金融投资网站开发
  • 生态农业网站模板有道云笔记 同步 wordpress
  • 建筑公司需求发布网站WordPress自定义tag模板
  • 长丰下塘新农村建设网站龙井茶网站建设目的
  • 建筑图集网站wordpress怎么设置404页面跳转
  • 集成wamp访问域名打开tp做的网站中国平面设计网
  • seo站内优化公司可以搜索企业信息的软件
  • 上海集酷网站百度推广授权代理商
  • 做旅游网站的原因成都定制网站设
  • 有几家做网站的公司好天津武清网站开发
  • 网站建设中小企业广西seo优化方向
  • 福田网站(建设深圳信科)做网站排名收益
  • 兰州新站点seo代理免费的网站搭建
  • 专注徐州网站建设手机网站欣赏
  • 电商网站建设系统百度最容易收录的网站
  • 贵阳网站开发推荐厦门建设局长
  • 网站群建设公司男的和女的做那个视频网站
  • 做的网站怎样百度能搜到海外酒店 网站建设
  • 如何撤销网站上信息吗峰峰信息港
  • 利为汇网站建设电商网站合作
  • 自学网站开发百度云资源网站运营的具体工作包括哪些
  • 新网站如何做排名企业计划书模板范文
  • 重庆网站建设价格百度云图片转wordpress
  • 网站开发答辩深圳php网站开发
  • 东莞石排网站建设电子商务在线网站建设
  • 成都响应网站建设四川省营山县西城建筑公司网站
  • 大连最好的做网站的公司自学商城网站建设
  • 做网页建网站挣钱北京平台网站建设公司
  • 建设局网站投诉电话少儿编程课是学什么的
  • 网站 布局上海十大知名装修公司