ICollection.java 436 Bytes
import java.util.Iterator;

public interface ICollection<E> extends Iterable<E> {
  public void add(E e);
  public void clear();

  public Iterator<E> iterator();

  default public boolean contains(E e) {
    for (E item : this) {
      if (e == null ? item == null : e.equals(item)) {
        return true;
      }
    }
    return false;
  }

  public int size();
  default public boolean isEmpty() {
    return this.size() == 0;
  }
}