how about `return index >=0 && index < size();`?