-
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
Lint fixes for unnecessary unboxing #3369
Lint fixes for unnecessary unboxing #3369
Conversation
@@ -57,9 +57,9 @@ public String toString() { | |||
@Override | |||
public int compare(TimedAction action1, TimedAction action2) { | |||
if (action1.time == action2.time) { | |||
return Long.valueOf(action1.count).compareTo(Long.valueOf(action2.count)); | |||
return Long.valueOf(action1.count).compareTo(action2.count); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you turn these into a < b ? -1 : ((a > b) ? 1 : 0)
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid misunderstanding, don't use Long.compare()
because we need to be Java 6 compatible and that method is not available in it.
See the comment, otherwise 👍. |
+1 for @akarnokd comment, otherwise 👍 |
@akarnokd @stevegury used ternaries in-place of |
👍 |
1 similar comment
👍 |
Lint fixes for unnecessary unboxing
Believe I'm removing some unnecessary unboxing calls, but please correct me if I'm wrong.