Merge pull request #23071 from ielatif

* pr/23071:
  Polish "Replace with 'Integer.compare()'"
  Replace with 'Integer.compare()'

Closes gh-23071
This commit is contained in:
Stephane Nicoll 2019-06-03 08:34:43 +02:00
commit cb97a1b371
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2019 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -56,7 +56,7 @@ public class InstanceComparator<T> implements Comparator<T> {
public int compare(T o1, T o2) { public int compare(T o1, T o2) {
int i1 = getOrder(o1); int i1 = getOrder(o1);
int i2 = getOrder(o2); int i2 = getOrder(o2);
return (i1 < i2 ? -1 : (i1 == i2 ? 0 : 1)); return (Integer.compare(i1, i2));
} }
private int getOrder(@Nullable T object) { private int getOrder(@Nullable T object) {