0

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!

1 Answers1

1

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

Louis Wasserman
  • 191,574
  • 25
  • 345
  • 413
  • "The package 'com.google' does not exist. You might be missing a library." Do I need to download the package? If so from where? I found this website: https://guava.dev/releases/23.0/api/docs/com/google/common/collect/Collections2.html – William Chandler Apr 18 '22 at 17:09