We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc0b7c6 commit 0d1f357Copy full SHA for 0d1f357
src/main/java/org/scijava/Prioritized.java
@@ -31,6 +31,8 @@
31
32
package org.scijava;
33
34
+import org.scijava.util.ClassUtils;
35
+
36
/**
37
* An object that can be sorted according to priority.
38
*
@@ -52,4 +54,18 @@ public interface Prioritized extends Comparable<Prioritized> {
52
54
*/
53
55
void setPriority(double priority);
56
57
+ // -- Comparable methods --
58
59
+ @Override
60
+ default int compareTo(final Prioritized that) {
61
+ if (that == null) return 1;
62
63
+ // compare priorities
64
+ final int priorityCompare = Priority.compare(this, that);
65
+ if (priorityCompare != 0) return priorityCompare;
66
67
+ // compare classes
68
+ return ClassUtils.compare(getClass(), that.getClass());
69
+ }
70
71
}
0 commit comments