Browse Source

Polishing

pull/1998/head
Juergen Hoeller 6 years ago
parent
commit
702d533e6f
  1. 5
      spring-core/src/main/java/org/springframework/core/OrderComparator.java

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

@ -59,7 +59,7 @@ public class OrderComparator implements Comparator<Object> { @@ -59,7 +59,7 @@ public class OrderComparator implements Comparator<Object> {
* @return the adapted comparator
* @since 4.1
*/
public Comparator<Object> withSourceProvider(final OrderSourceProvider sourceProvider) {
public Comparator<Object> withSourceProvider(OrderSourceProvider sourceProvider) {
return (o1, o2) -> doCompare(o1, o2, sourceProvider);
}
@ -78,10 +78,9 @@ public class OrderComparator implements Comparator<Object> { @@ -78,10 +78,9 @@ public class OrderComparator implements Comparator<Object> {
return 1;
}
// Direct evaluation instead of Integer.compareTo to avoid unnecessary object creation.
int i1 = getOrder(o1, sourceProvider);
int i2 = getOrder(o2, sourceProvider);
return (i1 < i2) ? -1 : (i1 > i2) ? 1 : 0;
return Integer.compare(i1, i2);
}
/**

Loading…
Cancel
Save