mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
ComparatorCombinatorsInspection: fix case, where inspection failed to recognize chain
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
// "Replace with Comparator chain" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class NodeDescriptor {
|
||||
|
||||
public int getWeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Comparator<NodeDescriptor> NODE_DESCRIPTOR_COMPARATOR = Comparator.comparingInt(NodeDescriptor::getWeight).thenComparingInt(NodeDescriptor::getIndex);
|
||||
}
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// "Replace with Comparator chain" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class NodeDescriptor {
|
||||
|
||||
public int getWeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static final Comparator<NodeDescriptor> NODE_DESCRIPTOR_COMPARATOR = (descriptor1, descriptor2) <caret>-> {
|
||||
int compare = Integer.compare(descriptor1.getWeight(), descriptor2.getWeight());
|
||||
if (compare != 0) {
|
||||
return compare;
|
||||
}
|
||||
return Integer.compare(descriptor1.getIndex(), descriptor2.getIndex());
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user