0

我正在尝试使用 Maven 在 Intellij-idea 中构建一个项目,但出现错误提示 "Cannot resolve method 'combinations' in 'Sets'

显示错误的代码在这里: 代码!

public Set<Set<String>> GetCombinationsSet(){
        System.out.println("Mapper: Calculating combinations");
        ArrayList<String> resources = new ArrayList<>(timeHarMap.keySet());
        Set<Set<String>> combinations = Sets.combinations(ImmutableSet.copyOf(resources), 2);
        //System.out.println(combinations.toArray().length);
        return combinations;
    }

进口即时通讯使用:

import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;

我在 pom.xml 中有番石榴依赖项,尝试放置此依赖项但它不起作用:

<dependency>
    <groupId>com.google.common</groupId>
    <artifactId>google-collect</artifactId>
    <version>0.5</version>
</dependency>

当我尝试构建它时出现错误的图像: 建造

4

1 回答 1

1

在你的 pom.xml 中试试这个

<dependency>
    <groupId>com.google.common</groupId>
    <artifactId>google-collect</artifactId>
    <version>1.0</version>
</dependency>
于 2021-08-26T23:25:25.053 回答