class SetCommunitiesVarCollector implements CommunitySetExprVisitor<Set<CommunityVar>, Configuration> {

  @Override
  public Set<CommunityVar> visitCommunitySetUnion(
      CommunitySetUnion communitySetUnion, Configuration arg) {
    return communitySetUnion.getExprs().stream()
        .flatMap(e -> e.accept(this, arg).stream())
        .collect(ImmutableSet.toImmutableSet());
  }

}