private T addEntry(T newEntry)
{
   BinaryNode<T> currentNode = getRootNode();
   assert currentNode != null;
   T result = null;
   boolean found = false;

   while (!found)
   {
      T currentEntry = currentNode.getData();
      int comparison = newEntry.compareTo(currentEntry);

      if (comparison == 0)
      {  // newEntry matches currentEntry;
         // return and replace currentEntry
         found = true;
         result = currentEntry;
         currentNode.setData(newEntry);
      }
      else if (comparison < 0)
      {
         if (currentNode.hasLeftChild())
            currentNode = currentNode.getLeftChild();
         else
         {
            found = true;
            currentNode.setLeftChild(new BinaryNode<>(newEntry));
         } // end if
      }
      else
      {
         assert comparison > 0;

         if (currentNode.hasRightChild())
            currentNode = currentNode.getRightChild();
         else
         {
            found = true;
            currentNode.setRightChild(new BinaryNode<>(newEntry));
         } // end if
      } // end if
   } // end while

   return result;
} // end addEntry
// Version 4.0
