xor method

Maybe<T>? xor(
  1. Maybe<T>? other
)

Returns Some if exactly one of this, other is Some, otherwise returns None

Implementation

Maybe<T> xor(Maybe<T> other) {
  if (this != null && other == null) return this;
  if (this == null && other != null) return other;
  return None();
}