我正在Macbook上的IntelliJ(社区2019.2)中编译Java。
我的代码:
import com.google.common.collect.Sets;
public static void main(String[] args) {
Sets.newConcurrentHashSet();// error ! cannot resolve the method !
}
我的pom:
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>20.0</version>
</dependency>
</dependencies>
基于
https://github.com/google/guava/blob/master/guava/src/com/google/common/collect/Sets.java
Sets.newConcurrentHashSet();
应该可用。
但是,为什么我不能叫它?
请使用以下依赖项。
<dependencies>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>28.1-jre</version>
</dependency>
</dependencies>
希望这会起作用。