import java.util.Iterator;

/**
 * @param <T> the base type of this Bag
 * @author Mark Young (A00000000)
 */
public interface Bag<T> {

    /**
     * Remove an item from this Bag. The item to remove is at the discretion of
     * the implementation.
     *
     * @return an arbitrary item removed from this Bag
     */
    public T remove();

    /**
     * Count how many times the given item appears in this Bag. That is, count
     * each {@code e} such that {@code Objects.equals(anItem, e)}.
     *
     * @param anItem the item to count
     * @return how many times that item appears in this Bag
     */
    public int count(T anItem);
    
    /*
     * Some default implementations for methods. I don't know why Collection
     * doesn't give these itself!
     */
    
    public int size();

    public boolean isEmpty();

    public boolean add(String newEntry);

    public boolean remove(Object anEntry);

    public void clear();

    public boolean contains(Object anEntry);

    public String[] toArray();

    public <T> T[] toArray(T[] starter);

    public Iterator<T> iterator();

}
