Procedure Specifications

Example: List

public class List {
  public List ();
  public void add (int i, Object e);
  public void set (int i, Object e);
  // modifies this
  // effects
  // throws IndexOutOfBoundsException if i < 0 or i >= length (this.elems)
  // else this.elems  [i] = e and this.elems unchanged elsewhere

  public void remove (int i);
  public int size ();
  public Object get (int i);
  // throws
  // IndexOutOfBoundsException if i < 0 or i > length (this.elems)

  // returns
  // this.elems [i] public void add (int i, Object e);
  }

José M. Vidal .

13 of 16