Hacker News new | past | comments | ask | show | jobs | submit login

Well, there are 6 different orders in which you could insert the 3 if statements, but I'm not sure that's a material difference :-)



Yes 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.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: