SyntaxFix
Write A Post
Hire A Developer
Questions
Usually I just check if the index is less than the array size
if (index < list.size()) { ... }
If you are also concerned of index being a negative value, use following
if (index >= 0 && index < list.size()) { ... }