code: public static <T> Observable.Transformer<T,ImmutableSet<T>> toImmutableSet() {
          return new Observable.Transformer<T, ImmutableSet<T>>() {
              @Override
              public Observable<ImmutableSet<T>> call(Observable<T> source) {
                  return source.collect(new Func0<ImmutableSet.Builder<T>>() {
                      @Override
                      public ImmutableSet.Builder<T> call() {
                          return ImmutableSet.builder();
                      }
                  }, new Action2<ImmutableSet.Builder<T>, T>() {
                      @Override
                      public void call(ImmutableSet.Builder<T> builder, T t) {
                          builder.add(t);
                      }
                  })
                  .map(new Func1<ImmutableSet.Builder<T>, ImmutableSet<T>>() {
                      @Override
                      public ImmutableSet<T> call(ImmutableSet.Builder<T> builder) {
                          return builder.build();
                      }
                  });
              }
          };
      }
docs: Returns a Transformer&lt;T,ImmutableSet&lt;T&gt;&gt that maps an Observable&lt;T&gt; to an Observable&lt;ImmutableSet&lt;T&gt;&gt;