package sets.multysets; import java.util.Iterator; public interface MultySet<E> { /** * Returns true of multyset is empty */ public boolean isEmpty() ; /** * Returns the number of all instances of all elements of the multyset */ public int size() ; /** * Removes all elements of multyset */ public void clear() ; /** * Returns an Iterator object to iterate over multyset */ public Iterator<E> iterator(); /** * Returns a copy of the multyset */ public MultySet<E> clone() ; /** * Adds an element with a given number of instances to the multyset */ public void add(E e, int card); /** * Removes all instances of an element of the multyset * Returns number of instances of removed element, null if element not in multyset */ public Integer removeElement(E e) ; /** * Removes an instance of an element of the multyset * Returns true if multyset is changed */ public boolean removeInstance(E e); /** * Returns number of instances of an element of the multyset, zero if not present */ public int contains(E e); /** * Overrides method equals of class Object */ public boolean equals(Object other) ; /** * Overrides method toString of class Object */ public String toString() ; /** * Returns true if this multyset is a subset of other multyset */ public boolean SubSetOf(MultySet<E> other); /** * Returns the union of this multyset and the other multyset */ public MultySet<E> union(MultySet<E> other) ; /** * Returns the intersection of this multyset and the other multyset */ public MultySet<E> intersection(MultySet<E> other) ; /** * Returns the difference of this multyset and the other multyset */ public MultySet<E> difference(MultySet<E> other); public E[] toArray(); }