Skip to content

Instantly share code, notes, and snippets.

@justinmusgrove
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinmusgrove/9019613 to your computer and use it in GitHub Desktop.
Save justinmusgrove/9019613 to your computer and use it in GitHub Desktop.
CombinationGenerator
@Test
public void test () {
Set<Integer> test = Sets.newHashSet(1, 2, 3, 4);
Set<Set<Integer>> elements = Sets.powerSet(test);
List<Integer> test2 = elements.stream().filter(p -> p.size() == 3).collect(Collectors.toList());
System.out.println(test2);
// [[1, 2, 3], [1, 2, 4], [1, 3, 4], [2, 3, 4]]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment