Skip to content

Commit 702d533

Browse files
committed
Polishing
1 parent 1535f98 commit 702d533

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

spring-core/src/main/java/org/springframework/core/OrderComparator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public class OrderComparator implements Comparator<Object> {
5959
* @return the adapted comparator
6060
* @since 4.1
6161
*/
62-
public Comparator<Object> withSourceProvider(final OrderSourceProvider sourceProvider) {
62+
public Comparator<Object> withSourceProvider(OrderSourceProvider sourceProvider) {
6363
return (o1, o2) -> doCompare(o1, o2, sourceProvider);
6464
}
6565

@@ -78,10 +78,9 @@ else if (p2 && !p1) {
7878
return 1;
7979
}
8080

81-
// Direct evaluation instead of Integer.compareTo to avoid unnecessary object creation.
8281
int i1 = getOrder(o1, sourceProvider);
8382
int i2 = getOrder(o2, sourceProvider);
84-
return (i1 < i2) ? -1 : (i1 > i2) ? 1 : 0;
83+
return Integer.compare(i1, i2);
8584
}
8685

8786
/**

0 commit comments

Comments
 (0)