Skip to content
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

Merged
merged 2 commits into from Sep 22, 2015

Conversation

KevinTCoughlin
Copy link

Believe I'm removing some unnecessary unboxing calls, but please correct me if I'm wrong.

@@ -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);
Copy link
Member

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?

Copy link
Member

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.

@akarnokd
Copy link
Member

See the comment, otherwise 👍.

@stevegury
Copy link
Member

+1 for @akarnokd comment, otherwise 👍

@akarnokd akarnokd added this to the 1.0.x milestone Sep 21, 2015
@KevinTCoughlin
Copy link
Author

@akarnokd @stevegury used ternaries in-place of Long.compareTo for Java 6 support. Thanks!

@stevegury
Copy link
Member

👍

1 similar comment
@akarnokd
Copy link
Member

👍

akarnokd added a commit that referenced this pull request Sep 22, 2015
@akarnokd akarnokd merged commit 6121baf into ReactiveX:1.x Sep 22, 2015
@KevinTCoughlin KevinTCoughlin deleted the remove-unnecessary-unboxing branch September 22, 2015 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants