No, there isn't any method for that built in the framework. I suppose that it was left out because you already have Min
and Max
, so you can accomplish it using them.
If you write your own method for it, it doesn't matter much how you write it. If you use if
statements or the conditional operator ?
, it will still compile to pretty much the same code anyway.