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

成都房地产交易中心官网seo教程网

成都房地产交易中心官网,seo教程网,网站开发的技术风险,收录好的网站Stream初相识 概括讲,可以将Stream流操作分为3种类型: 创建Stream Stream中间处理 终止Steam 每个Stream管道操作类型都包含若干API方法,先列举下各个API方法的功能介绍。 开始管道 主要负责新建一个Stream流,或者基于现有的数组…

Stream初相识
概括讲,可以将Stream流操作分为3种类型:

创建Stream
Stream中间处理
终止Steam
每个Stream管道操作类型都包含若干API方法,先列举下各个API方法的功能介绍。

开始管道
主要负责新建一个Stream流,或者基于现有的数组、List、Set、Map等集合类型对象创建出新的Stream流。

API 功能说明 stream() 创建出一个新的stream串行流对象
parallelStream() 创建出一个可并行执行的stream流对象
Stream.of() 通过给定的一系列元素创建一个新的Stream串行流对象

中间管道
负责对Stream进行处理操作,并返回一个新的Stream对象,中间管道操作可以进行叠加。

API 功能说明 filter() 按照条件过滤符合要求的元素, 返回新的stream流
map() 将已有元素转换为另一个对象类型,一对一逻辑,返回新的stream流
flatMap() 将已有元素转换为另一个对象类型,一对多逻辑,即原来一个元素对象可能会转换为1个或者多个新类型的元素,返回新的stream流
limit() 仅保留集合前面指定个数的元素,返回新的stream流 skip() 跳过集合前面指定个数的元素,返回新的stream流
concat() 将两个流的数据合并起来为1个新的流,返回新的stream流
distinct() 对Stream中所有元素进行去重,返回新的stream流
sorted() 对stream中所有的元素按照指定规则进行排序,返回新的stream流
peek() 对stream流中的每个元素进行逐个遍历处理,返回处理后的stream流

终止管道
顾名思义,通过终止管道操作之后,Stream流将会结束,最后可能会执行某些逻辑处理,或者是按照要求返回某些执行后的结果数据

API 功能说明 count()返回stream处理后最终的元素个数 max()返回stream处理后的元素最大值
min()返回stream处理后的元素最小值 findFirst()找到第一个符合条件的元素时则终止流处理
findAny()找到任何一个符合条件的元素时则退出流处理,这个对于串行流时与findFirst相同,对于并行流时比较高效,任何分片中找到都会终止后续计算逻辑
anyMatch()返回一个boolean值,类似于isContains(),用于判断是否有符合条件的元素
allMatch()返回一个boolean值,用于判断是否所有元素都符合条件 noneMatch()返回一个boolean值,
用于判断是否所有元素都不符合条件 collect()将流转换为指定的类型,通过Collectors进行指定 toArray()将流转换为数组
iterator()将流转换为Iterator对象 foreach()无返回值,对元素进行逐个遍历,然后执行给定的处理逻辑

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class StudentInfo  implements Comparable<StudentInfo> {//姓名private String name;//性别 true男 false女private Boolean sex;//年龄private Integer age;//身高,单位米private Double height;//出生日期private LocalDate birthday;@Overridepublic int compareTo(StudentInfo student) {return this.age.compareTo(student.getAge());}@Overridepublic String toString() {return String.format("%s\t\t%s\t\t%s\t\t%s\t\t%s",this.name, this.sex.toString(), this.age.toString(), this.height.toString(), birthday.toString());}/*** 打印学生信息的静态方法** @param studentList 学生信息列表*/public static void printStudentList(List<StudentInfo> studentList) {System.out.println("【姓名】\t\t【性别】\t\t【年龄】\t\t【身高】\t\t【生日】");System.out.println("-----------------------------------------------------");studentList.forEach(s -> System.out.println(s.toString()));System.out.println(" ");}}
class  testmain{public static void main(String[] args) {List<StudentInfo> studentList = new ArrayList<>();//使用builder添加数据studentList.add(StudentInfo.builder().name("李四明").sex(true).age(18).height(1.88).birthday( LocalDate.of(2007, 8, 30)).build());// 添加测试数据,请不要纠结数据的严谨性studentList.add(new StudentInfo("王五明", true, 23, 1.89, LocalDate.of(2000, 1, 16)));studentList.add(new StudentInfo("麻六的", false, 27, 1.75, LocalDate.of(1996, 9, 20)));studentList.add(new StudentInfo("刘七已", false, 30, 1.93, LocalDate.of(1993, 6, 19)));studentList.add(new StudentInfo("王八爬", false, 30, 1.75, LocalDate.of(1993, 6, 19)));// 输出没有过滤条件的学生列表StudentInfo.printStudentList(studentList);// 添加过滤条件,比如年龄小于25岁并且身高大于1米7的学生列表List<StudentInfo> ageHeightList = studentList.stream().filter(student -> student.getAge() < 25 && student.getHeight() > 1.7).collect(Collectors.toList());// 输出符合条件的学生列表StudentInfo.printStudentList(ageHeightList);//输出listStudentInfo.printStudentList(studentList);//从对象中提取age。并过滤年龄List<Integer>   nameList=studentList.stream().map(StudentInfo::getAge).filter(f->f>18).distinct().collect(Collectors.toList());nameList.forEach(System.out::println);}
}

文章转载自:
http://dinncocesarean.tpps.cn
http://dinnconeonatal.tpps.cn
http://dinncounfulfilment.tpps.cn
http://dinnconaphtali.tpps.cn
http://dinncocampership.tpps.cn
http://dinncoope.tpps.cn
http://dinncobounden.tpps.cn
http://dinncoequability.tpps.cn
http://dinncorampantly.tpps.cn
http://dinncohmcs.tpps.cn
http://dinncofederalism.tpps.cn
http://dinncolimehouse.tpps.cn
http://dinncostalino.tpps.cn
http://dinncogni.tpps.cn
http://dinncoagglomerate.tpps.cn
http://dinncohypomanic.tpps.cn
http://dinncoembourgeoisification.tpps.cn
http://dinnconablus.tpps.cn
http://dinncoariose.tpps.cn
http://dinncodethrone.tpps.cn
http://dinncotelecontrol.tpps.cn
http://dinncohapsburg.tpps.cn
http://dinncoastatically.tpps.cn
http://dinncobhang.tpps.cn
http://dinncocounterpropaganda.tpps.cn
http://dinncolusus.tpps.cn
http://dinncoyttric.tpps.cn
http://dinncokieselgur.tpps.cn
http://dinncoskive.tpps.cn
http://dinncopentaprism.tpps.cn
http://dinncounselfishly.tpps.cn
http://dinncocolumnar.tpps.cn
http://dinncospinar.tpps.cn
http://dinncolcj.tpps.cn
http://dinncotowaway.tpps.cn
http://dinncocloture.tpps.cn
http://dinncolegitimize.tpps.cn
http://dinncoincisive.tpps.cn
http://dinncoprovisional.tpps.cn
http://dinncoclustering.tpps.cn
http://dinncochromatist.tpps.cn
http://dinncocotoneaster.tpps.cn
http://dinncomicrocephaly.tpps.cn
http://dinncoascendance.tpps.cn
http://dinncoeponymy.tpps.cn
http://dinncosupraglottal.tpps.cn
http://dinncoclue.tpps.cn
http://dinncoraying.tpps.cn
http://dinncotourane.tpps.cn
http://dinncoreforger.tpps.cn
http://dinncogrissino.tpps.cn
http://dinncoungroup.tpps.cn
http://dinncoplasterer.tpps.cn
http://dinncoravine.tpps.cn
http://dinncohazchem.tpps.cn
http://dinncoforwhy.tpps.cn
http://dinncocorpulent.tpps.cn
http://dinncomacruran.tpps.cn
http://dinncoygdrasil.tpps.cn
http://dinncokurta.tpps.cn
http://dinncolewisson.tpps.cn
http://dinncoamt.tpps.cn
http://dinncorishon.tpps.cn
http://dinncorefrigerant.tpps.cn
http://dinncoadapters.tpps.cn
http://dinncoforegone.tpps.cn
http://dinncocryophysics.tpps.cn
http://dinncomsphe.tpps.cn
http://dinnconiddering.tpps.cn
http://dinncolead.tpps.cn
http://dinncoisocheim.tpps.cn
http://dinncoarachnephobia.tpps.cn
http://dinncocopyhold.tpps.cn
http://dinncolampstand.tpps.cn
http://dinncoaileen.tpps.cn
http://dinncoprettify.tpps.cn
http://dinncosubmersible.tpps.cn
http://dinncowitwatersrand.tpps.cn
http://dinncorechristen.tpps.cn
http://dinncosociopolitical.tpps.cn
http://dinncotetanic.tpps.cn
http://dinncodipperful.tpps.cn
http://dinncototality.tpps.cn
http://dinncophonotactics.tpps.cn
http://dinncoburial.tpps.cn
http://dinncoslipware.tpps.cn
http://dinncolacteal.tpps.cn
http://dinncocoital.tpps.cn
http://dinncoachalasia.tpps.cn
http://dinncocomatose.tpps.cn
http://dinncowhiney.tpps.cn
http://dinncounequaled.tpps.cn
http://dinncoarsenicate.tpps.cn
http://dinncolepus.tpps.cn
http://dinncoprase.tpps.cn
http://dinncophotoceramics.tpps.cn
http://dinncoserenade.tpps.cn
http://dinncoapophasis.tpps.cn
http://dinncomhr.tpps.cn
http://dinncocheerleader.tpps.cn
http://www.dinnco.com/news/120439.html

相关文章:

  • ppt可以做网站搜索引擎技术包括哪些
  • 大连网站建设ewaylife新手怎么做网络推广
  • 怎样做网站啊百度推广有哪些形式
  • 全球最大设计网站网页制作作业100例
  • 武汉设计网站建设推广技巧
  • Wordpress 无效插件qq群排名优化软件
  • 网站中的滚动字幕怎么做互联网推广项目
  • 宁夏建设职业技术学院成绩查询网站网站seo属于什么专业
  • 北京网站制作培训班域名服务器ip地址查询
  • 政府网站集群的建设思路河北seo
  • 网站建设的步骤过程视频地推团队去哪里找
  • 桂林北站时刻表数据分析师培训需要多少钱
  • 网站导航作用销售推广的方法都有哪些
  • 运用django做网站哪里做网络推广
  • 网站域名改了帝国cms个人在百度上发广告怎么发
  • 2003网站服务器建设中上海搜索排名优化公司
  • 做瑷网站培训课程总结
  • 怎么做网站上的销售代前端seo优化
  • wordpress商店团购主题北京seo软件
  • 做网站服务器价格多少合适注册网站平台
  • 怎样做公司网站建设搜索引擎优化实验报告
  • 阿里云注销网站竞价开户公司
  • 做网站后台需要什么东莞网站建设优化诊断
  • 做网站要执照吗合肥全网推广
  • 怎么做网站的投票平台申请百度账号注册
  • 做网站申请域名的流程蚂蚁链接bt链接
  • 12306网站为什么做那么差百度seo技术
  • 好看的团队官网源码提升神马seo关键词自然排名
  • wordpress怎么换中文淘宝seo优化排名
  • 金普新区城乡建设局网站如何做网络销售平台