# compare method

1. @override

int compare(

1. Object o1,
2. Object o2

)
override

Compares two objects for order.

This is the core comparison method that implements the Comparator interface. It determines the relative ordering of two objects based on their order precedence as defined by the JetLeaf ordering system.

### Parameters:

- `o1`: The first object to compare
- `o2`: The second object to compare

### Returns:

- A negative integer if `o1` should come before `o2`
- A positive integer if `o2` should come before `o1`
- Zero if `o1` and `o2` have the same order precedence

### Comparison Logic:

1. PriorityOrdered objects always come before non-priority objects
2. Within the same priority class, objects are ordered by their order value
3. Lower order values indicate higher precedence

### Example:

    final comp1 = MyComponent()..getOrder = () => 1;
    final comp2 = MyComponent()..getOrder = () => 2;

    final result = OrderComparator.INSTANCE.compare(comp1, comp2);
    print(result); // -1 (comp1 comes before comp2)

## Implementation

    @override
    int compare(Object o1, Object o2) => whenCompared(o1, o2);