Just use the size of the list (this is not an array):
if (x.size() <= index || x.get(index) == null) {
...
}
Or, if you want to define a valid index with a non-zero value, you should use:
if (index < x.size() && x.get(index) != null) {
...
}
In both cases, the call getwill not be made if the first part of the expression finds that the index is not valid for the list.
, " 6" ( 7 ) " 6, null" - , , .