singleOr method
T
singleOr(
- T orElse
Checks if the set has only one element, and returns that element.
Return null
if the set is empty or has more than one element.
Implementation
T singleOr(T orElse) => (length != 1) ? orElse : single;