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

公司的网站建设推广普通话的意义30字

公司的网站建设,推广普通话的意义30字,自己做微商想做个网站,如何做可以微信转发的网站数组遍历与排序 数组定义 //定义 int a[] new int[5]int[] a new int[5];//带初始值定义 int b[] {1,2,3,4,5};赋值 //定义时赋值 int b[] {1,2,3,4,5};//引用赋值 a[6] 1 a[9] 9 //未赋值为空取值 //通过下表取值,从0开始 b[1] 1 b[2] 2遍历 Test p…

数组遍历与排序

  • 数组定义
//定义
int a[] = new int[5]int[] a = new int[5];//带初始值定义
int b[] = {1,2,3,4,5};
  • 赋值
//定义时赋值
int b[] = {1,2,3,4,5};//引用赋值
a[6] = 1
a[9] = 9   //未赋值为空
  • 取值
//通过下表取值,从0开始
b[1] = 1
b[2] = 2
  • 遍历
@Test
public void method(){int a[] = new int[5];for (int j = 0;j < a.length; j++){a[j] = j;}for (int j = 0;j < a.length ;j++){System.out.println(a[j]);}
}

数组通过下标获取值且索引从0开始,通过.length属性获取长度。

  • 排序

数组排序的方法很多,冒泡,选择,快速等,请移步各种排序算法总结(全面)感谢作者! 😃

这里主要介绍选择排序,核心思想:取第一位依次与后面的元素比较大小,如前者大于后者则交换位置,依次循环(升序排列),该方法共循环 (n为数组长度)
n×(n−1)n\times (n-1) n×n1

for(int i =0;i< b.length;i++){for (int j=i+1;j<b.length;j++){int tmp;tmp = b[i+1];b[i] = b[i+1];b[i+1] = b[i];}
}

List的遍历与排序

  • 顺序表定义
//定义
ArrayList<Integer> list = new ArrayList<>();List<?> list = null;  //接口不能实例化

List只能存储包装类和对象。ArrayList可以存储任意数据类型。

  • 赋值
//定义时赋值
ArrayList<Integer>  list = new ArrayList<>(Arrays.asList(1,2,3,4,5));list.add()  //add方法赋值
  • 取值
//通过get(index)方法取值
Integer integer = list.get(0);索引index仍然从0开始//修改
list.set(index,value)//删除
list.remove(Object)
  • 遍历
@Test
//foreach 遍历
for (Integer i:list) {System.out.println(i);
}//iterator遍历
Iterator iterator = list.iterator();while (iterator.hasNext()){System.out.println(integer);
}//for循环遍历
for(int i =0;i<list.size();i++){System.out.println(list.get(i));
}
  • 排序
    @Testpublic void method7(){List<Integer> list = new ArrayList<>(Arrays.asList(2,1,5,4,3));for (int i=0;i<list.size();i++){for (int j=i;j<list.size()-1;j++){int tmp;if (list.get(i)> list.get(i+1)){tmp = list.get(i+1);list.set(i+1,list.get(i));list.set(i,tmp);}}}for (Integer i:list) {System.out.println(i);}}

在这里插入图片描述

选择排序

Map的遍历与排序

  • Map定义
Map<?,?> map = null;
Map<?,?> Map = new HashMap<>();

Map是接口不能被实例化

  • 赋值
@Test
public void method9(){Map<?,?> map1 = null;Map<String,Integer> map = new HashMap<>();//添加map.put("age",10);//赋值map.get("age");//修改map.replace("age",20);//删除map.remove("age");}

在实际使用时需要代入泛型,常用的时HashMap结构。

  • 遍历
@Test
//Map.Entry遍历
public void method10(){Map<String,String> map = new HashMap<>();map.put("name","_xiaoxu_");map.put("age","21");map.put("sex","男");//foreach遍历for (Map.Entry<String,String> entry: map.entrySet()) {//getKey方法获取keySystem.out.println(entry.getKey());//getValue方法获取valueSystem.out.println(entry.getValue());//setValue方法修改System.out.println(entry.setValue(""));}
}
//keySet遍历
for (String str:map.keySet()){System.out.println(map.get(str));
}//

Map.Entry是Map的一个元素,一个元组(key,value)。Map是数据结构,Map.Entry是数据类型,注意区分。

  • 排序
public class MapUtil {// Map的value值降序排序public static <K, V extends Comparable<? super V>> Map<K, V> sortDescend(Map<K, V> map) {List<Map.Entry<K, V>> list = new ArrayList<>(map.entrySet());Collections.sort(list, new Comparator<Map.Entry<K, V>>() {@Overridepublic int compare(Map.Entry<K, V> o1, Map.Entry<K, V> o2) {int compare = (o1.getValue()).compareTo(o2.getValue());return -compare;}});Map<K, V> returnMap = new LinkedHashMap<K, V>();for (Map.Entry<K, V> entry : list) {returnMap.put(entry.getKey(), entry.getValue());}return returnMap;}// Map的value值升序排序public static <K, V extends Comparable<? super V>> Map<K, V> sortAscend(Map<K, V> map) {List<Map.Entry<K, V>> list = new ArrayList<Map.Entry<K, V>>(map.entrySet());Collections.sort(list, new Comparator<Map.Entry<K, V>>() {@Overridepublic int compare(Map.Entry<K, V> o1, Map.Entry<K, V> o2) {int compare = (o1.getValue()).compareTo(o2.getValue());return compare;}});Map<K, V> returnMap = new LinkedHashMap<K, V>();for (Map.Entry<K, V> entry : list) {returnMap.put(entry.getKey(), entry.getValue());}return returnMap;}}

文章转载自:
http://zerobalance.c7507.cn
http://extrajudicial.c7507.cn
http://lockmaster.c7507.cn
http://aleph.c7507.cn
http://slight.c7507.cn
http://octant.c7507.cn
http://transpositional.c7507.cn
http://refill.c7507.cn
http://mapping.c7507.cn
http://catalysis.c7507.cn
http://bandicoot.c7507.cn
http://cony.c7507.cn
http://holoplankton.c7507.cn
http://solvend.c7507.cn
http://raster.c7507.cn
http://engraving.c7507.cn
http://yaunde.c7507.cn
http://photolith.c7507.cn
http://horselaugh.c7507.cn
http://prudish.c7507.cn
http://dallas.c7507.cn
http://trichomycin.c7507.cn
http://uncharitable.c7507.cn
http://opponens.c7507.cn
http://kissableness.c7507.cn
http://loft.c7507.cn
http://shim.c7507.cn
http://unpronounced.c7507.cn
http://astrometeorology.c7507.cn
http://remade.c7507.cn
http://monoclinic.c7507.cn
http://antiquate.c7507.cn
http://faithlessly.c7507.cn
http://barrel.c7507.cn
http://midsummer.c7507.cn
http://chemoceptor.c7507.cn
http://carpetbag.c7507.cn
http://loveless.c7507.cn
http://ripoff.c7507.cn
http://wristlet.c7507.cn
http://prime.c7507.cn
http://misdemeanor.c7507.cn
http://hashing.c7507.cn
http://clarabella.c7507.cn
http://submissive.c7507.cn
http://cowlike.c7507.cn
http://tsp.c7507.cn
http://penes.c7507.cn
http://follow.c7507.cn
http://boer.c7507.cn
http://subvention.c7507.cn
http://minaret.c7507.cn
http://egret.c7507.cn
http://semimonthly.c7507.cn
http://vycor.c7507.cn
http://mopy.c7507.cn
http://himeji.c7507.cn
http://legitimatize.c7507.cn
http://holster.c7507.cn
http://levelly.c7507.cn
http://kenny.c7507.cn
http://domsat.c7507.cn
http://ectogenesis.c7507.cn
http://vigorousness.c7507.cn
http://duero.c7507.cn
http://gambado.c7507.cn
http://pict.c7507.cn
http://orpharion.c7507.cn
http://chapman.c7507.cn
http://alamein.c7507.cn
http://monodisperse.c7507.cn
http://magic.c7507.cn
http://rotundity.c7507.cn
http://oceanologist.c7507.cn
http://zilog.c7507.cn
http://speculatory.c7507.cn
http://lanyard.c7507.cn
http://shaddock.c7507.cn
http://disarticulation.c7507.cn
http://remark.c7507.cn
http://plutolatry.c7507.cn
http://oncer.c7507.cn
http://throughway.c7507.cn
http://orthophotograph.c7507.cn
http://paradoctor.c7507.cn
http://pyrolusite.c7507.cn
http://rage.c7507.cn
http://habatsu.c7507.cn
http://aquanautics.c7507.cn
http://intoxicant.c7507.cn
http://lobby.c7507.cn
http://palaeomagnetism.c7507.cn
http://informally.c7507.cn
http://disemployment.c7507.cn
http://trapper.c7507.cn
http://unplausible.c7507.cn
http://signalise.c7507.cn
http://baldfaced.c7507.cn
http://phonomotor.c7507.cn
http://purl.c7507.cn
http://www.zhongyajixie.com/news/84104.html

相关文章:

  • 北京做网站周云帆百度快照怎么发布
  • 免费单页网站模板营销型企业网站有哪些平台
  • 网站如何做留言板头条发布视频成功显示404
  • 动漫设计与制作专业学校电商seo是什么
  • 邢台本地网站怎么宣传自己的店铺
  • 网站怎么做充值系统如何在百度发布广告信息
  • 做网站后台需要什么知识企业培训计划方案
  • 建站哪家好用兴田德润数字营销策略有哪些
  • 把网站做静态化正规优化公司哪家好
  • 在美国买云主机做网站关键词首页排名优化平台
  • 龙岗网站建设深圳信科2024年重大新闻简短
  • wordpress双语站企业qq邮箱
  • logo设计免费网址长沙正规竞价优化服务
  • 网站建设技术团队有多重要关键词seo
  • wordpress站内搜索次数seo优化流程
  • 便宜的购物网站排名如何修改百度上面的门店号码
  • 网站制作软件手机版今天发生的重大新闻事件
  • 做网站收录的网站有哪些seo建站优化
  • .课程网站建设与应用湖南seo优化排名
  • 答辩的时间_老师问了我做的网站可以同时支持的并发用户是多少seo优化网络
  • 建站工具箱接线图上海广告推广
  • 网站建设中主页指的是如何优化关键词提升相关度
  • 溧阳 做网站大一html网页制作作业
  • 长春做电商网站的公司千锋教育培训
  • 找图纸的网站南昌seo服务
  • 做钓鱼网站用哪种编程语言青岛新闻最新今日头条
  • 巩义网站建设方案书搜索引擎网站排名优化方案
  • 深圳知名网站建设价格seo高端培训
  • 如何跟帖做网站资源网站优化排名软件
  • 深圳网站制作电话交换链接营销