public int CompareTo(PrioritizedNode <T> otherNode) { if (otherNode is null) { return(1); } //note: we flip the sign of the priorityResult to sort descending (larger values come first) var priorityResult = _priority.CompareTo(otherNode._priority); return(priorityResult != 0 ? -priorityResult : _count.CompareTo(otherNode._count)); }
public bool Equals(PrioritizedNode <T> otherNode) { return(ReferenceEquals(this, otherNode) || (!(otherNode is null) && _priority.Equals(otherNode._priority) && _count.Equals(otherNode._count))); }