/**
 * CS1101 Lab 04 Ex 1: ListItem.java
 *
 * <fill in your discussion group here>
 *
 * This is a class used to store information.
 **/

public class ListItem
{
    private String name;
    public ListItem(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return this.name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    /*
     * For discussion: You can compare two ListItem objects
     * (ListItem i and ListItem j) by using the syntax
     * i.equals(j) which calls this method. Why?
     * The class Object will be discussed in class later.
     */
    public boolean equals(Object o)
    {
        ListItem l = (ListItem) this;
        ListItem m = (ListItem) o;
        return l.getName().equals(m.getName());
    }    

    public String toString()
    {
        return this.name;
    }
}


