-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed just() function in Observable class to varargs. #3798
Conversation
@princebansal please take a look at #686 for previous discussion about varargs |
@zsxwing Actually I was facing some build errors before. But now I have modified the code and using varargs. I think varargs is the better option to use rather than Iterator or multiple arguments. |
👎 The arity versions bind more highly in overload resolution so you will make every usage of That aside, arity overloads traditionally exist for a two reasons: to provide specific implementations which are more performant for the common cases and to avoid the |
I'm sorry, but this is PR is no good. There are several problems:
👎 |
I think keeping such high arity overloaded methods is not needed and appears unprofessional. Varargs with generics though displays warnings but is friendly for developers to code using IDE as it doesn't show all methods in predictions. Also an amount of code can be cut down. The warning can be Suppressed at user side or even if not, it is not going to cause any errors. |
Guava and JDK 9's factory methods disagree with you. Individual arity On Sat, Mar 26, 2016, 2:49 PM Prince Bansal [email protected]
|
Okay. As per experts guidance I am closing this PR and will surely contribute to this project in future with better enhancements. |
Just functions in Observable class were overloaded unnecessarily with increasing arguments from 1 to 10.
Marked all those methods as deprecated and defined one more overloaded just function with varargs as:
@SuppressWarnings("unchecked") public static <T> Observable<T> just(T... t) { return from(t); }
This will reduce the code redundancy and make it more elegant.