Q:

Using a Builder pattern to add to a Set<>

I have a class that contains a Set<> of objects, and I would like to make the class so that it cannot be fully instantiated until the client code has completely finished adding to this Set<>. I am thinking of using a Builder pattern, but instead of setting the Set<>, and thinking of adding to it instead, like so:  
public final class SyncManager {
    private ServiceManager serviceManager;

    private SyncManager(Builder builder) {
        serviceManager = new ServiceManager(builder.services);
    }

    public static Builder newBuilder() {
        return new Builder();
    }

    /**
     * {@code SyncManager} builder static inner class.
     */
    public static final class Builder {
        private Set<Service> services;

        private Builder() {
            this.services = new HashSet<>();
        }

        /**
         * Adds the {@code services} and returns a reference to this Builder so that the methods can be chained together
         * and more services can be added.
         *
         * @param newService the {@code services} to set
         * @return a reference to this Builder
         */
        public Builder addService(Service newService) {
            services.add(newService);
            return this;
        }

        /**
         * Returns a {@code SyncManager} built from the parameters previously set.
         *
         * @return a {@code SyncManager} built with parameters of this {@code SyncManager.Builder}
         */
        public SyncManager build() {
            return new SyncManager(this);
        }
    }
}

This is okay, right? I'm trying to think of other ways to ensure that SyncManager isn't completely instantiated until everything that needs to be added to the Set<> is in. And yes, I know I could just create the Set<> outside and pass it into SyncManager in a constructor, but I would like to not expose that. 
If there is a better way to accomplish what I'm doing, any input would help!

A:

This seems like a completely reasonable way to construct your object if you want to ensure that the set is not mutated outside of the builder/object.
Constructing it externally and passing it into the constructor would require that you copy it to a new Set<> if you wanted to ensure that the caller did not modify the set after the call.

