java.lang.Object
tools.refinery.interpreter.matchers.util.Sets

public final class Sets extends Object
This class was motivated by the similar Sets class from Guava to provide simple set manipulation functionality. However, as starting with version 2.3 the runtime of VIATRA Query should not depend on Guava, not even internally, the relevant subset of Sets methods will be reimplemented here.

The current approach is to delegate to Eclipse Collections wherever possible. Such glue methods are useful so that downstream clients can avoid directly depending on Eclipse Collections.

Without an equivalent from Eclipse Collections, cartesianProduct(List) is implemented here from scratch.

Since:
2.3
  • Constructor Details

    • Sets

      public Sets()
  • Method Details

    • newSet

      public static <A> Set<A> newSet(Iterable<A> elements)
      Since:
      2.4
    • intersection

      public static <A> Set<A> intersection(Set<A> left, Set<A> right)
    • difference

      public static <A> Set<A> difference(Set<A> left, Set<A> right)
    • union

      public static <A> Set<A> union(Set<A> left, Set<A> right)
    • powerSet

      public static <A> Set<? extends Set<A>> powerSet(Set<A> set)
    • cartesianProduct

      public static <A> Set<List<A>> cartesianProduct(List<? extends Set<? extends A>> setsList)