[英]The method of() is undefined for the type Set
when i'm trying to run this code: 当我尝试运行此代码时:
Set<Set<Integer>> s1 = Set.of(Set.of(), Set.of(1));
i'm getting this error: 我收到此错误:
The method of() is undefined for the type Set
The method of(int) is undefined for the type Set
I'm using Java 8. What is wrong? 我正在使用Java8。怎么了? :/
:/
These methods were introduced in Java SE 9. See the @since
in the source code on the API docs. 这些方法是Java SE 9中引入的。请参阅API文档源代码中的
@since
。 You'll need to upgrade to a current version of Java or use something else, such as new HashSet<>(Arrays.asList(fred, jim, sheila))
. 您将需要升级到Java的当前版本或使用其他版本,例如
new HashSet<>(Arrays.asList(fred, jim, sheila))
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.