William Chandler
William Chandler

Reputation: 55

Importing and Using Guava's Collections2 in Processing

I would like to use Guava's Collections2's permutations method as shown here: Get ArrayList of all possible permutations of an ArrayList but am having trouble importing it. I'm using Processing so I am wondering if there is anything different I need to do to use this with Processing, or if it is simply not possible.

This is the code I'm trying to make work from the link above:

import java.util.Collection;   //This seems to work
import java.util.Collections2; //This is what I assumed  I would need to import but doesn't seem to work
import com.google.common.collect.Collections2; // I also tried this

public void permutations () {
    List<Integer> vals = Ints.asList(new int[] {1, 2, 3});

    Collection<List<Integer>> orderPerm = Collections2.permutations(vals);

    for (List<Integer> val : orderPerm) {
        logger.info(val);
    }
}

Any help would be much apprecieated thanks!

Upvotes: 0

Views: 241

Answers (1)

Louis Wasserman
Louis Wasserman

Reputation: 198093

The second version of your import is the right one, at com.google.common.collect.

Upvotes: 1

Related Questions