withNoneAsGreatest

Returns an Order context for elements wrapped in Maybe where None is considered the greatest value.

In the resulting order:

  • Two None values are considered equal.

  • A None value is considered greater than any initial value wrapped in Some.

  • Two non-None values are compared using this order context and their inner values.

Receiver

The order context for initial elements.

Return

An Order instance where None is treated as the maximum value and Some values are treated as their inner initial values.

Type Parameters

Element

The element type for which to create the Maybe order context.


Returns a Comparator for nullable elements where null is considered the greatest value.

In the resulting comparator:

  • Two null values are considered equal

  • A null value is considered greater than any non-null value

  • Two non-null values are compared using this comparator

Receiver

The comparator for initial elements.

Return

A Comparator instance where None is treated as the maximum value and Some values are treated as their inner initial values.

Type Parameters

Element

The element type for which to create the Maybe comparator.