11 ms·
"Your honor, we believe John Fogerty is infringing on our sound when he plays guitar like himself." Any other way to write that method, short of changing the e
by slowmovintarget 10y ago
"Your honor, we believe John Fogerty is infringing on our sound when he plays guitar like himself."
Any other way to write that method, short of changing the exception text and variable names would be silly. The truly astonishing thing is that enough people could be fooled to think otherwise.
- Roboprog 10y agoWell, there are 6 different orders in which you could insert the 3 if statements, but I'm not sure that's a material difference :-)
- blktiger 10y agoYes and no, if the first conditional is moved then the behavior of the function would be different. You could for example specify a fromIndex of -1 and a toIndex of -2. That would result in an ArrayIndexOutOfBoundsException instead of an IllegalArgumentException. Arguably, it doesn't matter but if it's different than it wouldn't necessarily be compatible with other calling code. Of course that still leaves two other arrangements of the remaining code.
- gsylvie 10y agoNice Fogerty reference! (He's citing this case: https://en.wikipedia.org/wiki/Fogerty_v._Fantasy,_Inc. https://en.wikipedia.org/wiki/Fogerty_v._Fantasy,_Inc.)