Skip to content
Advertisement

Cannot resolve method ‘combinations’ in ‘Sets’

I was trying to build a project in Intellij-idea with Maven and got a error saying that "Cannot resolve method 'combinations' in 'Sets'

The code where the error is showing is here : Code!

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;
    }

The imports im using :

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

I have guava dependency in the pom.xml, tried putting this dependency but it doesn’t work:

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

Image with the error when i try to build it : Build

Advertisement

Answer

try this in your pom.xml

<dependency>
    <groupId>com.google.common</groupId>
    <artifactId>google-collect</artifactId>
    <version>1.0</version>
</dependency>
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement