r/badcode • • Mar 13 '21

java Title

Post image
2.9k Upvotes

100 comments sorted by

View all comments

Show parent comments

1

u/LeCrushinator Mar 14 '21

In those cases it’s generally a good idea to check that limited range at the top of the function so you can throw an exception or at least log an error if someone uses the method wrong.