阅读 76

datagrip格式化sql,java compareto方法返回值

package com.xqx.a04 _ practice.demo 04; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Comparator; import Java.util.function.function; import java.util.stream.Stream;/* * create author:xingqu anxiang * createtime:2019/8/1918336012 * description : * stream创建中间操作(按电话号码升序排序公共类测试(publicstaticvoidmain (string [ ] args ) throwsioexception (stringsmallfilepath=' day 22 ) ) )。/* system.out.print ln ((360825196211022750131992113491962-11-02 (.length )=6536082519621027501319950 system 10000 (() () 58*1.0*1024*1024 ) 1024/42/2 *///comparing实现//匿名内部类按电话号码升序/** * public static T,u extends come superucomparatortcomparing (* function? super T, extendsukeyextractor * { * objects.require nonnull (key extractor ); * return (comparatortserializable ) (C1,c2 )-keyextractor.apply (C1 ).compareto ) key extractor.apply ) ); * } * * comparing方法中有函数。 那个在new上有函数。 转换数据类型String --- Long *其中是电话号码,*/streamstringchunks=files.lines (paths.get ) smallfilepath ).sorted ) comparator (); //lambda表达式streamstringchunks1=files.lines (paths.get (small file path ) ).sorted ) comparator.comparing ) ) //已排序的数据//chunks1. foreach (system.out :3360 println ); //实现匿名内部类streamstringchunks2=files.lines (paths.get (small file path ) ) (.sorted (newcomparatorstring ) ) ) String o2 ) ) returnO1.split ) )2).compareto ) O2.split ) )\t ' )。 }; ); //lambda表达式是streamstringchunks3=files.lines (paths.get (small file path ) ) O1,o2 ) {returnO1.split} chunks3. foreach (system.out :3360 println ); }}/* 测试数据: 510603200107182516173917736712001-07-1844010620080221273159232839192008-02-2165231983198302074187218721965482 010231737136458231272000-10-233509231991083015311820785901991-08-3015020719700425923153057233333333333333333333330 12184617578051971-01-2013062619870725593186987179741987-07-2523128128119840402212517000007 7529803692016-10-28610611010610101010-286186161616101017986179810101610101 61012519691214142137853625401969-12-14526361971206555555 4101368493141987-03-15330122199111019502517805751991-10 9-06-143608251962119 202012386158106646422002-02-0161082719900801612218537597121990-08-015107222000000009188818888814751475175751751806 01315368177297378451992-01-3121018119891120572413230978478471989-11-203712021949123030301501750492017549204-12-3012-303017171717120120171717171717172017171717171717 06-06-2153082519790917526150657239101979-09-1763262195806086050154870028161958-06

日期升序的结果如下。

现在让我们来扩展一下。 如果有14亿条数据,一个txt文本大小为58G,该如何以最快的速度排序?


文章分类
代码人生
版权声明:本站是系统测试站点,无实际运营。本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 XXXXXXo@163.com 举报,一经查实,本站将立刻删除。
相关推荐