Ordered stream access on ObjectProvider with strong order guarantees
Issue: SPR-17272
This commit is contained in:
@@ -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> {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user