Explore BrainMass
Share

Explore BrainMass

    Java class UnorderedList

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Public class UnorderedList
    {
    public UnorderedList()
    // Post: List is the empty list.

    public boolean contains(String item)
    // Post: If item is in the list contains is
    // True; False, otherwise

    public void add(String item)
    // Pre: item is not already in the list
    // Post: item is in the list

    public void resetList()
    // Post: Iteration variable has been set to listPtr

    public String next()
    // Pre: An unseen item remains
    // The list has not been changed since the
    // last call to this method
    // Post: iteration variable has been updated
    // The item is returned

    public boolean hasNext()
    // Post: Returns true if there is an unseen item;
    // returns false otherwise

    private Node listPtr; // external pointer
    private Node currentItem // iteration variable
    }

    Completely implement above given class UnorderedList, and write a driver to create and print a list using data file "Names.dat".

    © BrainMass Inc. brainmass.com October 10, 2019, 1:29 am ad1c9bdddf
    https://brainmass.com/computer-science/linked-lists/java-class-unorderedlist-336543

    Solution Summary

    A Java class unordered list is examined.

    $2.19