X306: LinkedBag equals

Write the equals() method for the LinkedBag<T> ADT. Your equals() method implementation will be inserted/compiled inside the LinkedBag<T> code available to you through the example configured assignment ExLinkedBagsJUnit that you can download in Eclipse (the class name has been shortened in this question to "LinkedBag"). The author's source code is also available online.

The member fields your method implementations may access/change are:

/**
 * A class of bags whose entries are stored in a chain of linked nodes.
 * 
 * @author Frank M. Carrano
 * @author Timothy M. Henry
 * @version 4.0
 */
public final class LinkedBag<T> implements BagInterface<T>
{
    private Node firstNode;  // Reference to first node
    private int numberOfEntries;
    ...
}

Your implementation code for this problem may also access/invoke any of the Bag API methods. (Your solution code may also include helper methods.)

Write your implementation of equals() below.

Your Answer:

Feedback

Your feedback will appear here when you check your answer.