Assume this is a situation where you will encounter an index that is out of bounds and have to do something logical with it rather than throw an unchecked exception. Also assume that this is called very often and is rarely out of bounds. Would avoiding the length checks when they're rarely needed anyway be good or is it just bad to use an exception unnecessarily even in such circumstances?
Tony Morris
Java Q&A (FAQ, Trivia)
Having said that, this question is borderline developer's opinion.
[OCP 11 Complete Study Guide] [OCP 11 Programmer I Book] [OCP 11 Programmer II Book] [OCP 11 Practice Tests Book] [OCA 8 Book] [OCP 8 Book] [OCP 8 Practice Tests Book] [Blog]
I often feel dumb checking my array bounds, since the lookup code has to go ahead and check them again anyway.
[OCP 11 Complete Study Guide] [OCP 11 Programmer I Book] [OCP 11 Programmer II Book] [OCP 11 Practice Tests Book] [OCA 8 Book] [OCP 8 Book] [OCP 8 Practice Tests Book] [Blog]
Don't get me started about those stupid light bulbs. |