class Collection {
  protected {
    init() {
    }
  }

  public {
    Boolean mutable() {
      return refine answer() to Boolean;
    }

    void add(Object item) {
      refine do(item) to void;
    }

    void addAll(Collection other) {
      if(refinable(do)) {
        refine combine(other) to void;
      } else {
        Iterator items := other.iterator();
        while(not items.done()) {
          add(items.next());
        }
      }
    }

    void clear() {
      refine do() to void;
    }

    Boolean contains(Object item) {
      if(refinable(check)) {
        return refine check(item) to Boolean;
      }

      Iterator items := this.iterator();
      while(not items.done()) {
        if(items.next() = item) {
          return true;
        }
      }
      return false;
    }

    Boolean containsAll(Collection other) {
      if(refinable(check)) {
        return refine check(other) to Boolean;
      }

      Iterator items := other.iterator();
      while(not items.done()) {
        if(not this.contains(items.next())) {
          return false;
        }
      }
      return true;
    }
  }
}
