网站生成小程序,上海市建设安全协会网站,今天邯郸下的紧急通知,旅游网页有哪些Java SE 11也被命名为18.9#xff08;基于使用发布年份和月份的新命名方案#xff09;#xff0c;预计将在9月的最后一周发布GA。 频繁发布新JDK版本的新方法是允许语言创建者引入新功能#xff0c;并向开发人员社区更快地进行API更新。 通常#xff0c;API更新不会引起注… Java SE 11也被命名为18.9基于使用发布年份和月份的新命名方案预计将在9月的最后一周发布GA。 频繁发布新JDK版本的新方法是允许语言创建者引入新功能并向开发人员社区更快地进行API更新。 通常API更新不会引起注意并且会被一些重大更改所掩盖。 因此我想到了枚举Java 11中可能没有的Java 10中的一些API更改。 我正在使用从此处下载的jdk-11-ea 16构建 Character.toStringint 此方法返回给定Unicode代码点的字符串表示形式如下所示 jshell Character.toString(100)
$10 d
jshell Character.toString(66)
$7 BCharacterSequence.comparejava.lang.CharSequencejava.lang.CharSequence 这将按字典顺序比较两个字符序列如果第一个字符序列在字典上小于或等于第二个则返回负零或正。 词典上的意思是字典顺序或字母顺序。 jshell CharSequence.compare(girl, boy)
$12 5jshell CharSequence.compare(girl, girl)
$13 0jshell CharSequence.compare(hello, world)
$14 -15 重复int jshell **.repeat(5)
$15 **********jshell **.repeat(-7)
| Exception java.lang.IllegalArgumentException: count is negative: -7
| at String.repeat (String.java:3147)
| at (#16:1)jshell **.repeat(0)
$17 jshell **.repeat(1)
$18 **isBlank jshell String msg hello
msg hellojshell msg.isBlank()
$22 falsejshell String msg
msg jshell msg.isBlank()
$24 truejshell String msg
msg jshell msg.isBlank()
$26 truestripstripTrailingstripLeading jshell hello world .strip()
$29 hello worldjshell hello world .strip()
$30 hello worldjshell hello world .stripTrailing()
$31 hello worldjshell hello world .stripLeading()
$32 hello world jshell .strip()
$33 lines jshell String content this is a multiline content\nMostly obtained from some file\rwhich we will break into lines\r\nusing the new api
content this is a multiline content\nMostly obtained fro ... ines\r\nusing the new apijshell content.lines()
$36 java.util.stream.ReferencePipeline$Head5ec0a365jshell content.lines().forEach(System.out::println)
this is a multiline content
Mostly obtained from some file
which we will break into lines
using the new apijava.nio.file.Path.of 在此版本之前有没有在工厂方法java.nio.file.Path 虽然有一个方法java.nio.file.Paths 。 此版本在java.nio.file.Path中引入了一种工厂方法该方法有两个变体 1.将String放置到资源中 2.将URI位置带到资源 两者都显示如下 jshell Path uriPath Path.of(new URI(file:///C:/Program%20Files/Java/jdk-11/release))
uriPath C:\Program Files\Java\jdk-11\releasejshell Files.readAllLines(uriPath).forEach(System.out::println)jshell Path filePath Path.of(.., release)
filePath ..\releasejshell Files.readAllLines(filePath).forEach(System.out::println)Pattern.asMatchPredicate 此API返回java.util.function.Predicate 可用于测试给定的字符串是否与使用java.util.regex.Pattern编译的模式匹配 jshell Pattern somePattern Pattern.compile(\\w\\w[.]com)
somePattern \w\w[.]comjshell PredicateString somePredicate somePattern.asMatchPredicate()
somePredicate java.util.regex.Pattern$$Lambda$26/0x00000008000d084034c4973jshell somePredicate.test(sanagmail.net)
$55 falsejshell somePredicate.test(sanagmail.com)
$56 truejshell somePredicate.test(sana#gmail.com)
$57 false 与Java EE相关的API即CorbaJAXBJAX WSWeb服务已被删除。 直到Java 10从孵化器移到其自己的模块java.net.http之前孵化器中一直使用的HTTP客户端库。 我很快会在新的HTTP客户端上写一些帖子。 翻译自: https://www.javacodegeeks.com/2018/06/api-updates-java.html