We begin by testing ifthe list is empty by calling the isEmptymethod
(defined at lines 60 to 63),which returns trueiffirstis null.Ifthe list is
empty, we assign itemto first at line 22. If firstis not null,we copy the cur-
rent list into a new list at lines 25–28.We instantiate a temporary list, temp-
List.We then assign first to the first instance variable oftempList and rest to
the restinstance variable oftempList.At that point,we have copied the ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.