cucumber.runtime.HookComparator Maven / Gradle / Ivy
package cucumber.runtime;
import java.util.Comparator;
class HookComparator implements Comparator {
private final boolean ascending;
public HookComparator(boolean ascending) {
this.ascending = ascending;
}
@Override
public int compare(HookDefinition hook1, HookDefinition hook2) {
int comparison = hook1.getOrder() - hook2.getOrder();
return ascending ? comparison : -comparison;
}
}