code: public T set(int index, T element)
      {
          switch (index)
          {
              case 0:
                  T previousElement1 = this.element1;
                  this.element1 = element;
                  return previousElement1;
              case 1:
                  T previousElement2 = this.element2;
                  this.element2 = element;
                  return previousElement2;
              default:
                  throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + this.size());
          }
      }
docs: set is implemented purely to allow the List to be sorted, not because this List should be considered mutable.