Hey there, I have a question regarding the builder pattern that I need someone with more experience to clarify for me.
I have this User class that has an inner, public static Builder class that has the same fields as User as well as the corresponding setter methods. Now, the setter methods inside the Builder class return this (the builder instance), and after everything is set, the instance of the builder is passed to Builder.build(this) method that returns a User instance with the fields.
My question is that I can make User setter methods to return this (User object) and render the inner Builder class unnecessary. However, since it is there, I assume there might be some reason why it is so. Anybody any suggestion as to why is one way better than the other?
Thanks in advance.