// Item.java -- define individual items for a bag. public class Item { private String name; public Item(String s) { name = s; } // In order to make the remove(Object) method work in the bag class, // we need indexOf() to find the appropriate element, so we need a // way to compare 2 items. public boolean equals(Item i) { return name.equals(i.name); } public String toString() { return name; } }