Yes, of course. In fact, it can be simplified.
Linear search can be simplified if it does not have to
test each array entry for null
.
Here is some code with search()
partially finished:
Recall that search()
returns
either a reference to the correct entry,
or null
if the entry could not be found.
Complete the search()
method.