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

中介网站建设wordpress分页导航不显示不出来

中介网站建设,wordpress分页导航不显示不出来,做笔记网站,郑州七彩网站建设公司 交通jdk 1.8 jdk8JDK 8中引入的三个新类是java.util包的DoubleSummaryStatistics #xff0c; IntSummaryStatistics和LongSummaryStatistics 。 这些类使计算元素总数#xff0c;元素的最小值#xff0c;元素的最大值#xff0c;元素的平均值以及双精度#xff0c;整数或long… jdk 1.8 jdk8 JDK 8中引入的三个新类是java.util包的DoubleSummaryStatistics IntSummaryStatistics和LongSummaryStatistics 。 这些类使计算元素总数元素的最小值元素的最大值元素的平均值以及双精度整数或long的集合中的元素总和变得轻松快捷。 每个类的类级别Javadoc文档都以相同的单句开头简洁地表达了这一点并将每个句子描述为“一个用于收集统计信息例如计数最小值最大值总和和平均值的状态对象”。 这三个类中的每个类的类级Javadoc都声明了每个类的状态“该类旨在用于尽管不需要流。” 包含这三种类型的SummaryStatistics类的最明显的原因是要与JDK 8一起引入的流一起使用。 实际上三个类的类级别Javadoc注释中的每个注释也提供了将每个类与相应数据类型的流结合使用的示例。 这些示例演示了如何调用各个Stream的collectSupplierBiConsumerBiConsumer方法 可变归约 终端流操作 并将每个SummaryStatistics类的新实例 构造函数传递给accept方法 并将方法作为方法引用 传递给此collect方法作为其“供应商”“累加器”和“合并器”参数。 本文的其余部分将演示IntSummaryStatistics LongSummaryStatistics和DoubleSummaryStatistics 。 这些示例中的几个示例将参考《 X档案》电视连续剧的季节地图以该季节首映的尼尔森收视率。 这显示在下一个代码清单中。 声明和初始化xFilesSeasonPremierRatings /*** Maps the number of each X-Files season to the Nielsen rating* (millions of viewers) for the premiere episode of that season.*/ private final static MapInteger, Double xFilesSeasonPremierRatings;static {final MapInteger, Double temporary new HashMap();temporary.put(1, 12.0);temporary.put(2, 16.1);temporary.put(3, 19.94);temporary.put(4, 21.11);temporary.put(5, 27.34);temporary.put(6, 20.24);temporary.put(7, 17.82);temporary.put(8, 15.87);temporary.put(9, 10.6);xFilesSeasonPremierRatings Collections.unmodifiableMap(temporary); } 下一个代码清单使用在上一个代码清单中创建的映射演示将DoubleSummaryStatistics应用于DoubleSummaryStatistics的“值”部分的流并且与Javadoc中为三个SummaryStatistics类提供的示例非常相似。 DoubleSummaryStatistics类 IntSummaryStatistics类和LongSummaryStatistics类具有基本相同的字段方法和API仅差异是受支持的数据类型。 因此即使本示例以及本示例中的许多示例都专门使用DoubleSummaryStatistics 因为X文件的Nielsen等级是DoubleSummaryStatistics 该原理仍适用于SummaryStatistics类的其他两种不可或缺的类型。 将DoubleSummaryStatistics与基于集合的流一起使用 /*** Demonstrate use of DoubleSummaryStatistics collected from a* Collection Stream via use of DoubleSummaryStatistics method* references new, accept, and combine.*/ private static void demonstrateDoubleSummaryStatisticsOnCollectionStream() {final DoubleSummaryStatistics doubleSummaryStatistics xFilesSeasonPremierRatings.values().stream().collect(DoubleSummaryStatistics::new,DoubleSummaryStatistics::accept,DoubleSummaryStatistics::combine);out.println(X-Files Season Premieres: doubleSummaryStatistics); } 接下来显示运行上述演示的输出 X-Files Season Premieres: DoubleSummaryStatistics{count9, sum161.020000, min10.600000, average17.891111, max27.340000} 上一个示例直接基于集合 Map的“值”部分将SummaryStatistics类应用于流。 下一个代码清单演示了一个类似的示例但是使用IntSummaryStatistics并使用流的中间映射操作来指定要在集合的对象上调用哪个Function来填充SummaryStatistics对象。 在这种情况下由Java8StreamsMoviesDemo.getMoviesSample()方法返回的SetMovie对集合进行操作并在我的博客文章JDK 8中的Stream-Powered Collections Functionality中进行了详细说明 。 将IntSummaryStatistics与Stream的地图一起使用功能 /*** Demonstrate collecting IntSummaryStatistics via mapping of* certain method calls on objects within a collection and using* lambda expressions (method references in particular).*/ private static void demonstrateIntSummaryStatisticsWithMethodReference() {final SetMovie movies Java8StreamsMoviesDemo.getMoviesSample();IntSummaryStatistics intSummaryStatistics movies.stream().map(Movie::getImdbTopRating).collect(IntSummaryStatistics::new, IntSummaryStatistics::accept, IntSummaryStatistics::combine);out.println(IntSummaryStatistics on IMDB Top Rated Movies: intSummaryStatistics); } 执行上面的演示时其输出如下所示 IntSummaryStatistics on IMDB Top Rated Movies: IntSummaryStatistics{count5, sum106, min1, average21.200000, max49} 到目前为止这些示例已在最常用的情况下与基于现有集合的流中的数据结合使用使用SummaryStatistics类进行了演示。 下面的例子演示了如何DoubleStream可以从头开始通过利用被实例化DoubleStream.Builder然后DoubleStream的summaryStatistics方法可以被调用来获得的实例DoubleSummaryStatistics 。 从DoubleStream获取DoubleSummaryStatistics的实例 /*** Uses DoubleStream.builder to build an arbitrary DoubleStream.** return DoubleStream constructed with hard-coded doubles using* a DoubleStream.builder.*/ private static DoubleStream createSampleOfArbitraryDoubles() {return DoubleStream.builder().add(12.4).add(13.6).add(9.7).add(24.5).add(10.2).add(3.0).build(); }/*** Demonstrate use of an instance of DoubleSummaryStatistics* provided by DoubleStream.summaryStatistics().*/ private static void demonstrateDoubleSummaryStatisticsOnDoubleStream() {final DoubleSummaryStatistics doubleSummaryStatistics createSampleOfArbitraryDoubles().summaryStatistics();out.println(Arbitrary Double Statistics: doubleSummaryStatistics); } 刚列出的代码将产生以下输出 Arbitrary Double Statistics: DoubleSummaryStatistics{count6, sum73.400000, min3.000000, average12.233333, max24.500000} 当然类似于刚刚所示的例子中 IntStream和IntStream.Builder可以提供的一个实例IntSummaryStatistics和LongStream和LongStream.Builder可以提供的一个实例LongSummaryStatistics 。 一个人不需要拥有StreamStream或BaseStream的其他实例即可使用SummaryStatistics类因为它们可以直接实例化并直接用于预定义的数字统计操作。 下一个代码清单通过直接实例化然后填充DoubleSummaryStatistics的实例来演示这DoubleSummaryStatistics 。 直接实例化DoubleSummaryStatistics /*** Demonstrate direct instantiation of and population of instance* of DoubleSummaryStatistics instance.*/ private static void demonstrateDirectAccessToDoubleSummaryStatistics() {final DoubleSummaryStatistics doubleSummaryStatistics new DoubleSummaryStatistics();doubleSummaryStatistics.accept(5.0);doubleSummaryStatistics.accept(10.0);doubleSummaryStatistics.accept(15.0);doubleSummaryStatistics.accept(20.0);out.println(Direct DoubleSummaryStatistics Usage: doubleSummaryStatistics); } 接下来显示运行前面的代码清单的输出 Direct DoubleSummaryStatistics Usage: DoubleSummaryStatistics{count4, sum50.000000, min5.000000, average12.500000, max20.000000} 就像前面的DoubleSummaryStatistics代码清单中DoubleSummaryStatistics 下一个代码清单直接实例化LongSummaryStatistics并将其填充。 此示例还演示了SummaryStatistics类如何提供用于请求单个统计信息的单个方法。 直接实例化LongSummaryStatistics /请求单个统计信息 /*** Demonstrate use of LongSummaryStatistics with this particular* example directly instantiating and populating an instance of* LongSummaryStatistics that represents hypothetical time* durations measured in milliseconds.*/ private static void demonstrateLongSummaryStatistics() {// This is a series of longs that might represent durations// of times such as might be calculated by subtracting the// value returned by System.currentTimeMillis() earlier in// code from the value returned by System.currentTimeMillis()// called later in the code.LongSummaryStatistics timeDurations new LongSummaryStatistics();timeDurations.accept(5067054);timeDurations.accept(7064544);timeDurations.accept(5454544);timeDurations.accept(4455667);timeDurations.accept(9894450);timeDurations.accept(5555654);out.println(Test Results Analysis:);out.println(\tTotal Number of Tests: timeDurations.getCount());out.println(\tAverage Time Duration: timeDurations.getAverage());out.println(\tTotal Test Time: timeDurations.getSum());out.println(\tShortest Test Time: timeDurations.getMin());out.println(\tLongest Test Time: timeDurations.getMax()); } 现在显示此示例的输出 Test Results Analysis:Total Number of Tests: 6Average Time Duration: 6248652.166666667Total Test Time: 37491913Shortest Test Time: 4455667Longest Test Time: 9894450 在本文的大多数示例中我都依赖SummaryStatistics类的可读toString实现来演示每个类中可用的统计信息。 但是最后一个示例说明每种单独的统计类型值的数量最大值最小值值的总和和平均值都可以以数字形式分别检索。 结论 无论所分析的数据是直接作为数字流提供还是通过集合的流间接提供还是手动放置在适当的SummaryStatistics类实例中这三个SummaryStatistics类都可以提供有关整数长整数和双精度数的有用的常用统计计算。 翻译自: https://www.javacodegeeks.com/2015/04/the-jdk-8-summarystatistics-classes.htmljdk 1.8 jdk8
http://www.zqtcl.cn/news/190113/

相关文章:

  • 网站建设中首页模板下载网页制作模板保存
  • 宁夏做网站的江苏网站建设的案例展示
  • 网站功能需求文档如何免费域名注册
  • 推广网站的软件包头移动的网站建设
  • 自己制作音乐的软件免费上海seo怎么优化
  • 学vue可以做pc网站网站站长统计怎么弄
  • 做物流的可以在那些网站找客户大淘客网站建设app
  • 石家庄兼职做网站dedecms做视频网站
  • 优化公司怎么优化网站的网站 意义
  • 唯品会一家专门做特卖的网站手机版招聘网站开发技术维护
  • 做短租哪个网站wordpress 4.7
  • 网站换空间 site网站域没到期不能续费吗
  • 找别人做网站要考虑哪些网站导航条设计欣赏
  • mvc网站开发实例wordpress雪人主题2.0
  • 红色好看的网站中山网站建设工作室
  • 如何做喊单网站flask公司网站开发
  • 简单个人网站制作流程自己怎么做卖服装的网站
  • 网站开发公司创业做洁净的网站
  • 要建一个优惠卷网站怎么做企业开发小程序公司
  • 汕尾英文网站建设企业qq手机版
  • 重庆医院门户网站建设做百度网站电话号码
  • windows网站建设教程网站建设落地页
  • 新加坡做网站的价格网站正则表达式怎么做
  • 三门峡市住房的城乡建设局网站百度指数分析官网
  • 新网站外链怎么做陕西省煤炭建设第一中学官方网站
  • 学校网站建设方面汇报php网站开发和部署
  • 源码建站和模板建站区别商城网站功能
  • 临沂建站公司互联网开网站怎么做
  • 有哪个网站做ic购物网站建设需求
  • 怎么登录甘肃省建设厅网站工信部域名信息备案管理系统查询