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

设计网站网站名称2021最新域名没被封的

设计网站网站名称,2021最新域名没被封的,德化住房和城乡建设网站,wordpress角色什么是Stream#xff1f; 也叫Stream流#xff0c;是jdk8开始新增的一套API#xff0c;可以用来操作集合或者数组的数据 优势#xff1a;Stream流大量的结合了Lambda的语法风格来编程#xff0c;提供了一种更加强大#xff0c;更加简单的方式操作集合或数组中的数据 也叫Stream流是jdk8开始新增的一套API可以用来操作集合或者数组的数据 优势Stream流大量的结合了Lambda的语法风格来编程提供了一种更加强大更加简单的方式操作集合或数组中的数据代码更简洁可读性更好 import java.util.*; import java.util.stream.Collectors;public class Work1 {public static void main(String[] args) {ListString names new ArrayList();names.add(温小辉);names.add(小朱);names.add(简隋英);names.add(邵群);names.add(小白);System.out.println(names);//找出带小的名字存入新的集合中去ListString list new ArrayList();for (String name : names) {if (name.contains(小)name.length()2){list.add(name);}}System.out.println(list);//开始使用Stream流List list1 names.stream().filter(s-s.contains(小)).filter(a-a.length()2).collect(Collectors.toList());System.out.println(list1);} } 1如何获取集合和数组的Stream流 import java.util.*; import java.util.stream.Stream;public class Work1 {public static void main(String[] args) {//1,如何获取List集合的Stream流ListString names new ArrayList();Collections.addAll(names,温小辉,小朱,简隋英,邵群,小白);StreamString stream names.stream();//2,如何获取Set集合的Stream流SetString set new HashSet();Collections.addAll(set,李玉,李程秀,兰波,白新羽,何故);StreamString stream1 set.stream();stream1.filter(s - s.contains(李)).forEach(s - System.out.println(s));//3,如何获取Map集合的Stream流?MapString,Doublemap new HashMap();map.put(娘娘腔,9.5);map.put(你却爱着一个SB,9.9);map.put(人鱼陷落,9.8);map.put(附加遗产,9.6);//键流final SetString keys map.keySet();final StreamString ks keys.stream();//值流final CollectionDouble values map.values();final StreamDouble vs values.stream();//键值对流final SetMap.EntryString, Double entries map.entrySet();final StreamMap.EntryString, Double kvs entries.stream();kvs.filter(e-e.getKey().contains(人)).forEach(e-System.out.println(e.getKey()--e.getValue()));String[] names2 {言逸,陆上锦,陆言,毕揽星,百刃};final StreamString s1 Arrays.stream(names2);final StreamString s2 Stream.of(names2);} } 2Stream流的常用方法 import java.util.*; import java.util.stream.Stream;public class Work1 {public static void main(String[] args) {//需求一找出成绩大于等于60分的数据并升序后再输出ListDouble scores new ArrayList();Collections.addAll(scores, 88.5,100.0,60.0,99.0,9.5,99.6,25.0);scores.stream().filter(s-s60).sorted().forEach(s- System.out.println(s));ListStudent students new ArrayList();Student s1 new Student(简隋英,32,188);Student s2 new Student(简隋英,32,188);Student s3 new Student(邵群,31,189);Student s4 new Student(洛羿,19,187);Student s5 new Student(李玉,21,188.5);Student s6 new Student(白新羽,22,185.2);Student s7 new Student(何故,25,183);Collections.addAll(students,s1,s2,s3,s4,s5,s6,s7);//找出年龄大于等于20且小于等于30并按照年龄降序输出students.stream().filter(s-s.getAge()20 s.getAge()30).sorted(((o1, o2) - o2.getAge()- o1.getAge())).forEach(s- System.out.println(s));System.out.println(.....................................);//取出身高最高的前三名students.stream().sorted(((o1, o2) - Double.compare(o2.getHeight(), -o1.getHeight()))).limit(3).forEach(s- System.out.println(s));System.out.println(......................................);//取出身高最矮的两名students.stream().sorted(((o1, o2) - Double.compare(o2.getHeight(), -o1.getHeight()))).skip(students.size()-2).forEach(s- System.out.println(s));//找出身高超过188的叫什么名字要求去掉重复的名字再输出//distinct去重复自定义类型的对象(希望内容一样就认为重复重写hashCode和equals方法)students.stream().filter(s-s.getHeight()188).map(s-s.getName()).distinct().forEach(s - System.out.println(s));final StreamString st1 Stream.of(张三, 王五);final StreamString st2 Stream.of(张三1, 王五2);final StreamObject allSt Stream.concat(st1, st2);allSt.forEach(s- System.out.println(s));}} class Student{private String name;private int age;private double height;public Student() {}public Student(String name, int age, double height) {this.name name;this.age age;this.height height;}public String getName() {return name;}public void setName(String name) {this.name name;}public int getAge() {return age;}public void setAge(int age) {this.age age;}public double getHeight() {return height;}public void setHeight(double height) {this.height height;}Overridepublic String toString() {return Student{ name name \ , age age , height height };} } 3Stream流常见的终结方法 import java.util.*; import java.util.stream.Collectors;public class Work1 {public static void main(String[] args) {ListStudent students new ArrayList();Student s1 new Student(简隋英,32,188);Student s2 new Student(邵群,31,189);Student s3 new Student(洛羿,19,187);Student s4 new Student(李玉,21,188.5);Student s5 new Student(白新羽,22,185.2);Student s6 new Student(何故,25,183);Collections.addAll(students,s1,s2,s3,s4,s5,s6);//找出身高超过188的并输出final long size students.stream().filter(s - s.getHeight() 188).count();System.out.println(size);//取出身高最高的并输出final Student s students.stream().max((o1, o2) - Double.compare(o1.getHeight(), o2.getHeight())).get();System.out.println(s);//取出身高最矮的两名Student ss students.stream().min((o1, o2) - Double.compare(o1.getHeight(), o2.getHeight())).get();System.out.println(ss);//找出身高超过185的并放到一个新集合中去返回List Student students1 students.stream().filter(a-a.getHeight()185).collect(Collectors.toList());System.out.println(students1);//找出身高超过185的并把对象的姓名和身高放到Map集合中去返回MapString,Double map students.stream().filter(a-a.getHeight()185).collect(Collectors.toMap(a-a.getName(),a-a.getHeight()));System.out.println(map);//放在数组中去Object[] arr students.stream().filter(a - a.getHeight() 185).toArray();System.out.println(Arrays.toString(arr));} }
http://www.yutouwan.com/news/222537/

相关文章:

  • 现在可以用的网站网页浏览器设置在哪里
  • 广州自助建站寓意好的公司名字
  • 河南省建设网站首页好看的标志设计
  • 怎么查一个网站做的外链流放之路做装备词缀网站
  • 给客户做一个网站ppt怎么做互动网页设计
  • 推广易官网给公司网站做seo的好处
  • 广州建站优化html5商城网站
  • 网站上传 404wordpress 搜索自定义数据表字段
  • 网站建设电上海定制建设网站
  • 西安地区专业做网站公司wordpress上一篇
  • 网站鼠标代码口碑好的购物平台
  • 中英文网站好处深圳品牌建网站
  • 韩城市网站建设如何在招聘网站上做薪酬统计
  • 做个爬架网站如何做做贸易怎么找客户
  • 无锡嘉饰茂建设网站地方新闻门户网站源码
  • 推荐医疗网站建设展示营销型网站
  • 企业网站模板源码免费南通网站开发公司
  • 手机网站淘宝客怎么做wordpress 2.0 下载地址
  • 开源的企业网站管理系统静态网站漏洞
  • 如何提高网站关键词排名wordpress修改教程
  • 留学网站建设方案织梦做的网站打开空白
  • 列举网站建设的SEO策略海南省住房和城乡建设厅网站网上版
  • 新乡网站建设设计广州微网站建设dmz100
  • 常德政务网站app制作定制外包88
  • 回收网站怎么做xampp 搭建wordpress
  • 在那做网站discuz手机版
  • nas搭建wordpress博客网站wordpress产品属性搭配
  • 企业网站建站企业管理咨询公司企业文化
  • 有系统源码可以做网站吗百度信息流代运营
  • 玉泉路做网站安徽省建设工程资源网