Skip to content

Instantly share code, notes, and snippets.

@trickyBytes
Created July 25, 2017 08:21
Show Gist options
  • Save trickyBytes/81258877772ccb70bdbd3493174290f3 to your computer and use it in GitHub Desktop.
Save trickyBytes/81258877772ccb70bdbd3493174290f3 to your computer and use it in GitHub Desktop.
Using Guava collection builders and Sets to create Cartesian product of some packages
List<List<IComponentsAction>> alternatives ...
Set<List<IComponentsAction>> product ...
final Builder<Set<IComponentsAction>> builder = ImmutableList.<Set<IComponentsAction>>builder();
alternatives.forEach(pkg -> {
builder.add(ImmutableSet.copyOf(pkg));
});
product = Sets.cartesianProduct(builder.build());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment