compareTo method

  1. @override
int compareTo(
  1. LazyWeakReference<Object> other
)
override

Orders instances first by _unixTimeMs and then by the unique id to guarantee a strict total order.

The tie-breaker ensures compareTo never returns 0 for distinct objects, allowing multiple references with the same timestamp to coexist inside a SplayTreeSet.

Instances must only be compared with others produced by the same manager, since id uniqueness is only guaranteed within that scope.

Implementation

@override
int compareTo(LazyWeakReference<Object> other) {
  final cmp = _unixTimeMs.compareTo(other._unixTimeMs);
  if (cmp != 0) return cmp;
  return id.compareTo(other.id);
}