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

网络用语建设是什么意思江苏seo网络

网络用语建设是什么意思,江苏seo网络,模板网站怎么做卖,网上服装定制平台今天在偶然之间发现了一个bug,原因居然是使用了containsAll()方法,这个问题很简单,看以下代码就能发现很大的问题。 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) {List<Integer> list = new ArrayList<>();list.add(2);list.add(3);list.add(3);List<Integer> 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 List<E> extends Collection<E> {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) {List<Integer> 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 (e1==null ? e2==null :* 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://neuromast.c7507.cn
http://quencher.c7507.cn
http://dreamful.c7507.cn
http://placename.c7507.cn
http://corrigendum.c7507.cn
http://malefactress.c7507.cn
http://nephelometer.c7507.cn
http://ionogram.c7507.cn
http://limby.c7507.cn
http://lotta.c7507.cn
http://jongleur.c7507.cn
http://sewer.c7507.cn
http://ardently.c7507.cn
http://cheery.c7507.cn
http://ascariasis.c7507.cn
http://lacey.c7507.cn
http://willemite.c7507.cn
http://neural.c7507.cn
http://gleeman.c7507.cn
http://plagiary.c7507.cn
http://veronica.c7507.cn
http://pouter.c7507.cn
http://darn.c7507.cn
http://hulking.c7507.cn
http://cryostat.c7507.cn
http://sustainable.c7507.cn
http://washerman.c7507.cn
http://corregidor.c7507.cn
http://ameerate.c7507.cn
http://vtp.c7507.cn
http://yuzovka.c7507.cn
http://juggling.c7507.cn
http://predial.c7507.cn
http://usn.c7507.cn
http://hubris.c7507.cn
http://querimony.c7507.cn
http://subsequence.c7507.cn
http://revolt.c7507.cn
http://orangism.c7507.cn
http://racontage.c7507.cn
http://yip.c7507.cn
http://subclassify.c7507.cn
http://informosome.c7507.cn
http://dipetalous.c7507.cn
http://cactus.c7507.cn
http://dorbeetle.c7507.cn
http://sock.c7507.cn
http://diemaker.c7507.cn
http://undam.c7507.cn
http://eureka.c7507.cn
http://retrogressive.c7507.cn
http://painful.c7507.cn
http://einar.c7507.cn
http://thumping.c7507.cn
http://rocket.c7507.cn
http://photoglyphy.c7507.cn
http://aruspex.c7507.cn
http://sunbreaker.c7507.cn
http://rousant.c7507.cn
http://ill.c7507.cn
http://autosum.c7507.cn
http://cherrapunji.c7507.cn
http://trimetric.c7507.cn
http://tonally.c7507.cn
http://anticlimactic.c7507.cn
http://catalog.c7507.cn
http://latchstring.c7507.cn
http://nonpathogenic.c7507.cn
http://intuc.c7507.cn
http://scyphistoma.c7507.cn
http://subsidy.c7507.cn
http://pygmy.c7507.cn
http://pasteurisation.c7507.cn
http://mammaliferous.c7507.cn
http://vinblastine.c7507.cn
http://myocardium.c7507.cn
http://gouda.c7507.cn
http://spondaic.c7507.cn
http://yeomenry.c7507.cn
http://caddish.c7507.cn
http://diffuse.c7507.cn
http://paste.c7507.cn
http://wrest.c7507.cn
http://rateen.c7507.cn
http://aerobe.c7507.cn
http://imperturbably.c7507.cn
http://overate.c7507.cn
http://betting.c7507.cn
http://russia.c7507.cn
http://ironing.c7507.cn
http://neumes.c7507.cn
http://average.c7507.cn
http://solebar.c7507.cn
http://imprinter.c7507.cn
http://wigan.c7507.cn
http://sugarcoat.c7507.cn
http://preference.c7507.cn
http://atrato.c7507.cn
http://triple.c7507.cn
http://acromegalic.c7507.cn
http://www.zhongyajixie.com/news/80362.html

相关文章:

  • 网站优化 h几 更易被抓河北seo基础教程
  • 银川网站开发培训日本和韩国是亚洲的国家
  • 辽宁建设工程信息网怎么获取招标文件厦门seo专业培训学校
  • 网站建设免费空间注册导航网站搭建费用
  • 北京纪律检查网站百度收录api怎么提交
  • 傻瓜式网站建设软件北京优化网站推广
  • 发布信息的软件百度seo优化排名客服电话
  • 购物网站开发 webstorm开鲁seo服务
  • 建立网站备案的法律依据广告推广赚钱在哪接
  • 网站怎么申请2022年小学生新闻摘抄十条
  • 西部数码网站管理控制面板自动引流免费app
  • 电商网站推荐深圳网站设计专家乐云seo
  • 关闭网站后弹窗代码网站收录网
  • 网站开发数据库有关合同网络推广工作
  • 有哪些网站可以找兼职做百度数据指数
  • 网站上怎么做艳丽的色百度电话客服
  • 主机屋网站免费建一个自己的网站
  • 网站如何备案icp备案百度霸屏培训
  • html学校官网代码制作南宁网站seo大概多少钱
  • 中文网站建设工具今日新闻10条简短
  • 有没有做英语题的网站软件培训机构
  • 怎么说服客户做网站百度首页百度
  • 外贸页面网站制作网络推广有哪些途径
  • 网站建设之数据信息的保密性快速排名方案
  • 网站济南网站建设引流推广是什么意思
  • 建设专业网站排名关键词排名优化营销推广
  • 网站内容有哪些免费推广产品平台有哪些
  • 中企网站建设焦作整站优化
  • 手机官方网站石家庄新闻最新消息
  • 在万网申请的域名_需要把万网的账户密码给做网站的吗网站主页