You have written a method that has a return statement in an if condition. This is not a problem if all of the possible exits from the method result in either an exception or a return statement. Have a look at the pseudo code below:
Which one do you feel works for your solution ? I would expect your method to behave the same as Math.min() method when both operands are the same.
My brains working harder than they should in order to understand how you said it "should be".
I'd expect it to be:
One would think not a big difference, well, for me it is.
Also I've added <=, I find it easier to understand that way. I'd expect that majority would find it easier that way, simply because looking to "if" part one could identify in case of equal values what value would be returned without even looking how "else" part is implemented.
Is that a spider in your hair? Here, threaten it with this tiny ad:
Sauce Labs - World's Largest Continuous Testing Cloud for Websites and Mobile Apps