LD11: Overriding Equals due Wed 03 Apr 10:00

\begin{purpose}
In this assignment you will:
\begin{itemize}
\item Learn how...
...tem Use inheritance to build a specialized object.
\end{itemize}
\end{purpose}

Preparation for Lab Day

Do these steps:
  1. In your workspace, make sure you have the latest homework files from the base repository. This will create a hw11 directory in which you will do your work.
  2. Copy these files from hw10 to the hw11 directory: Word.java, WordNode.java, WordList.java, Driver.java.
  3. Spend some time looking at this discussion of ways to properly override .equals() for a Java object:

    https://stackoverflow.com/questions/8180430/how-to-override-equals-method-in-java NOTE: Don't only read the accepted answer!

  4. Modify Word.java to override .equals() and .hashCode() so when .equals() is called it returns true if the word values match (false otherwise).
  5. Comment out existing code in the driver and use the driver to demonstrate and test your new code.
  6. When finished add changes, commit, and push.

Lab Day

Do these steps:
  1. Now that you have a way to test two Word objects for equality we will go ahead and implement search and remove. Start with by uncommenting the search method in WordList.java.
  2. Modify the search routine so that it returns a reference to a found Word object (rather than to a WordNode). Also, make use of your .equals() method.
  3. Test the search() method by making appropriate adjustments in the driver. Once you are convinced it works: document and commit.
  4. Now turn your attention to the remove() method and go through similar steps to get it working.
  5. Test, document, commit, push.
  6. Now that you have a fully working WordList class we will inherit from it to create a specialized list that we will use to investigate the prevalence of anagrams in a dictionary file.
  7. Use the remainder of lab time to read the homework and begin work on the described LinkedDictionary class.