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

建材做网站好吗将网页加入可信站点

建材做网站好吗,将网页加入可信站点,东莞市seo网络推广怎么样,石家庄网站推广服务平台因为项目的需要#xff0c;今天抽时间把JAVA中的容器复习了一下#xff0c;为了以后的不时之需#xff0c;现在把它记下来。 容器有其名#xff0c;知其意#xff0c;用来盛放数据的集合#xff0c;JAVA中为我们提供了三种容器类#xff1a;set、list、map#xff0c;三…  因为项目的需要今天抽时间把JAVA中的容器复习了一下为了以后的不时之需现在把它记下来。   容器有其名知其意用来盛放数据的集合JAVA中为我们提供了三种容器类set、list、map三种容器之间既有联系又有区别首先它们均继承了Collection容器区别在于set容器存储数据类似于集合里面的数据之间没有顺序不能重复list容器中的数据有序并且数据可以重复最后map容器是一种通过键值对进行的存储所以map容器要求键值不能重复。   通过这个图相信大家一定能够对JAVA容器有一个很好地认识。 接下来让我们一起看几个例子 第一个HashSet、LinkedList、ArrayList、Interator的介绍 public class hashset {public static void main(String[] args) {Collection c new HashSet();c.add(one);c.add(two);c.add(three);c.add(four);c.add(five);Iterator it c.iterator();while(it.hasNext()){System.out.println(it.next());}} } 输出结果HashSet存储里面的数据是无序的 public class linkedlist {public static void main(String[] args) {Collection c new LinkedList();c.add(one);c.add(two);c.add(three);c.add(four);c.add(five);Iterator it c.iterator();while(it.hasNext()){System.out.println(it.next());}} } 输出结果: public class hashset {public static void main(String[] args) {Collection c new HashSet();c.add(one);c.add(two);c.add(three);c.add(four);c.add(five);Iterator it c.iterator();while(it.hasNext()){System.out.println(it.next());}} } 输出结果 public class object_interator {public static void main(String [] args){Collection c new ArrayList();//特别注意add添加的均要为Object对象c.add(new student(张生, 男));c.add(new student(王二, 男));c.add(new student(莉莉, 女));c.add(new student(小明, 男));Iterator it c.iterator();while(it.hasNext()){student stu (student)it.next();//特别注意it.next()获得的是一个Object对象一定要转化为指定的对象然后进行操作System.out.println(stu);//默认调用其toString()方法}} }//定义的一个student对象 class student{public String name;public String sex;//无参构造方法public student(){}//有参构造方法public student(String name, String sex){this.name name;this.sex sex;}public String getname(){return name;}public String getsex(){return sex;}//从写其toString()方法public String toString(){return 姓名name 性别sex;} } 下面简单介绍一下SDK1.5提出的增强for循环 public class addFor {public static void main(String[] args) {int arr [] {1,2,3,4,5};for(int i0; iarr.length;i){System.out.println(传统的输出arr[i]);}System.out.println();for(int i : arr){System.out.println(增强的for循环输出i);}System.out.println();Collection c new ArrayList();c.add(new String(aaa));c.add(new String(bbb));c.add(new String(ccc));c.add(new String(ddd));for(Object o : c){System.out.println(o);//默认调用其toString()方法}} } 对于List容器JAVA给出了一种处理内部数据的方法Collections下面简单给大家分享一下我的理解 public class list_fix {public static void main(String [] args){List li new ArrayList();for(int i 0; i5; i){li.add(ai);}System.out.println(处理前li);Collections.reverse(li);//逆序排列System.out.println(li);Collections.shuffle(li);//随机排列System.out.println(li);Collections.sort(li);//排序System.out.println(li);int n Collections.binarySearch(li, a5);//基于二分法的查找System.out.println(a5的位置n);} } 输出结果 到这里我想大家估计已经对容器有了一定的了解如果你有更好的认识还望大家赐教。转载于:https://www.cnblogs.com/AndroidJotting/p/3935959.html
http://www.yutouwan.com/news/191643/

相关文章:

  • 重庆万州网站建设公司电话app软件开发用什么软件
  • 网站的技术建设方案wordpress怎样分类目录添加标签
  • 优化网站排名提高香河住房与建设局网站
  • 专业的网站建设公哪家专业房屋在线设计网站
  • 做网站的网站违不违法网页网站开发
  • 网站子站点是什么意思东莞市国外网站建设平台
  • 做垂直行业网站利润分析wordpress插件和主题区别
  • 青岛网站模板做网站需要准备的东西
  • 苏州建网站需要什么怎么免费建设个人博客网站
  • 新网站制作平台创新的南昌网站建设
  • 有关网站建设的说说禁忌网站有哪些
  • 静态网站 搜索功能英文企业网站源码 asp
  • 南通市交通建设处网站求职简历免费下载模板
  • 当当网站建设优点大连金州区旅游景点
  • 网站空间续费合同学网页设计需要什么学历
  • seo网站排名优化案例北京网站制作百度推广
  • 网站建设培训福州武器系统软件开发文档
  • 扬州建设企业网站做食物网站
  • 东莞网站设计讯息建设网站的会计分录
  • 宽屏企业网站模板系部网站开发计划书
  • 山东省最新消息今天wordpress主题优化
  • 然后在亚马逊网站上做外贸网络技术方案
  • wordpress建影视网站专业宣传片制作拍摄公司
  • 深圳网站建设_网站模板去哪下载
  • 学校二级网站建设自查情况如何建个使用自己帐户的网站
  • 郑网站建设制作灯笼的手工做法简单
  • 郑州做网站找哪家好北京建设工程信息网上报名基础信息
  • wordpress整站手机端html页面模板
  • 网站建设交付如何学做网页
  • 企业网站组网方案做网站需要的法律知识