Homework/HW02/List.cc
bool List::operator==(const List &data)
{
    //Assume the lists are equal.
    bool listsAreEqual = true;

    //If the lists have unequal size, they are not equal, and we have no need to compare.
    if (size != data.size)
        listsAreEqual = false;

    //If both lists start at the same node, then they are equal, and we have no need to compare.
    else if (head == data.head);

    //The head nodes are not the same, but the sizes are equal.  Compare the datum of the lists.
    else
    {
        ListIterator currentNode1 = head, currentNode2 = data.head;

        //Iterate through the lists and check the datums.
        while (listsAreEqual && currentNode1)
        {
            //Compare the datums.
            if (*currentNode1 != *currentNode2)
                listsAreEqual = false;

            //Go to the next node.
            ++currentNode1;
            ++currentNode2;
        }
    }

    //Return the result of the function.
    return listsAreEqual;
}
/****************************** operator== *********************************************************
Action:         Compares the content of two lists.  Does short-circuit evaluation by comparing the
                sizes of the two lists and the address of the head nodes and if the sizes are not
                equal or the addresses of the head nodes are the same, this function does not waste
                time comparing the contents of the lists.

Parameters:
IN:             const List &data, holds the second list to compare.
OUT:            None

Returns:        bool describing whether the two compared lists are equal or not.

Precondition:   None
***************************************************************************************************/
operator
Action:         Compares the content of two lists.  Does short-circuit evaluation by comparing the
sizes of the two lists and the address of the head nodes and if the sizes are not
equal or the addresses of the head nodes are the same, this function does not waste
time comparing the contents of the lists.

const List &data, holds the second list to compare.
OUT:            None

bool describing whether the two compared lists are equal or not.

None
operator Action : Compares the content of two lists . Does short - circuit evaluation by comparing the sizes of the two lists and the address of the head nodes and if the sizes are not equal or the addresses of the head nodes are the same this function does not waste time comparing the contents of the lists . const List &data holds the second list to compare . OUT : None bool describing whether the two compared lists are equal or not . None
bool List::operator==(const List &data)
{
    bool listsAreEqual = true;
    if (size != data.size)
        listsAreEqual = false;
    else if (head == data.head);
    else
    {
        ListIterator currentNode1 = head, currentNode2 = data.head;
        while (listsAreEqual && currentNode1)
        {
            if (*currentNode1 != *currentNode2)
                listsAreEqual = false;
            ++currentNode1;
            ++currentNode2;
        }
    }
    return listsAreEqual;
}
bool List :: operator == ( const List & data ) { bool listsAreEqual = true ; if ( size != data . size ) listsAreEqual = false ; else if ( head == data . head ) ; else { ListIterator currentNode1 = head , currentNode2 = data . head ; while ( listsAreEqual && currentNode1 ) { if ( * currentNode1 != * currentNode2 ) listsAreEqual = false ; ++ currentNode1 ; ++ currentNode2 ; } } return listsAreEqual ; }
operator
Action:         Compares the content of two lists.
operator Action : Compares the content of two lists .
//Assume the lists are equal. //If the lists have unequal size, they are not equal, and we have no need to compare. //If both lists start at the same node, then they are equal, and we have no need to compare. //The head nodes are not the same, but the sizes are equal.  Compare the datum of the lists. //Iterate through the lists and check the datums. //Compare the datums. //Go to the next node. //Return the result of the function.