Implementing a set using a linked list
Let's say that you are starting with a list containing five elements:

$$
\newcommand{ptr}[1]{\overset{\mathtt{#1}}{\longrightarrow}}
\mathtt{head} \ptr{} \fbox{first}  \ptr{next}
                     \fbox{second} \ptr{next}
                     \fbox{rest}   \ptr{next}
                     \fbox{of}     \ptr{next}
                     \fbox{list}   \ptr{next} \mathtt{null}
$$

Then, you add a non-duplicate item called "another".  After executing head.next=newNode:

$$
% "align" allows us to do vertical alignment
% "\\" separates lines
% "&amp;" is an alignment marker. The markers in different rows
% are positioned above each other, and horizontally centered.
\newcommand{ptr}[1]{\overset{\mathtt{#1}}{\longrightarrow}}
\begin{align*}
                                             &amp;\mathtt{newNode} \\
                                             &amp;\quad\downarrow  \\
\mathtt{head} \ptr{} \fbox{first} \ptr{next} &amp;\fbox{another} \ptr{next} \mathtt{null} \\
                                             &amp;\fbox{second}  \ptr{next}
                                              \fbox{rest}    \ptr{next}
                                              \fbox{of}      \ptr{next}
                                              \fbox{list}    \ptr{next}
                                              \mathtt{null}
\end{align*}
$$

You've just orphaned and discarded everything starting from the second element.  Then it gets worse when you set head=newNode.