Three LinkedList accessors are defined in Program .
The methods getHead and getTail
provide read-only access to the corresponding fields of LinkedList.
The method isEmpty returns a boolean result
which indicates whether the list is empty.
Clearly, the running time of each accessor is O(1).
Program: LinkedList class accessor methods.