[update] jdk 10的示例
This commit is contained in:
parent
b29d5741dc
commit
18dfea4d87
1
.gitignore
vendored
1
.gitignore
vendored
@ -34,3 +34,4 @@ build/
|
||||
|
||||
*.log
|
||||
*.class
|
||||
/demo2/java9-example/mods/
|
||||
|
@ -24,6 +24,7 @@ public class OtherFeaturesExample {
|
||||
// Collection.toArray() 新重载方法
|
||||
List<String> stringList = Arrays.asList("Java", "10", "新特性");
|
||||
// Java 10新增的重载方法,可以直接指定数组类型
|
||||
// String[] stringArray = stringList.toArray(stringList.toArray(new String[0]));
|
||||
String[] stringArray = stringList.toArray(String[]::new);
|
||||
System.out.println("Collection.toArray() 新方法结果: " + Arrays.toString(stringArray));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user