package java.util;

public class Arrays {
  private Arrays() { }

  public static String toString(Object[] a) {
    return asList(a).toString();
  }

  private static boolean equal(Object a, Object b) {
    return (a == null && b == null) || (a != null && a.equals(b));
  }

  public static <T> List<T> asList(final T ... array) {
    return new List<T>() {
      public String toString() {
        return Collections.toString(this);
      }

      public int size() {
        return array.length;
      }

      public boolean add(T element) {
        throw new UnsupportedOperationException();
      }

      public void add(int index, T element) {
        throw new UnsupportedOperationException();
      }

      public boolean contains(T element) {
        for (int i = 0; i < array.length; ++i) {
          if (equal(element, array[i])) {
            return true;
          }
        }
        return false;
      }

      public T get(int index) {
        return array[index];
      }

      public T set(int index, T value) {
        throw new UnsupportedOperationException();
      }

      public <S> S[] toArray(S[] a) {
        return (S[])array;
      }

      public boolean isEmpty() {
        return size() == 0;
      }

      public T remove(int index) {
        throw new UnsupportedOperationException();        
      }

      public boolean remove(T element) {
        throw new UnsupportedOperationException();
      }

      public void clear() {
        throw new UnsupportedOperationException();
      }

      public Iterator<T> iterator() {
        return new Collections.ArrayListIterator(this);
      }
    };
  }
}

@@ -264,24 +264,368 @@
 s(b));%0A  %7D%0A%0A
+  public static %3CT%3E void sort(T%5B%5D array, Comparator%3C? super T%3E comparator) %7B%0A    // insertion sort%0A    for (int j = 1; j %3C array.length; ++j) %7B%0A      T t = array%5Bj%5D;%0A      int i = j - 1;%0A      while (i %3E= 0 && comparator.compare(array%5Bi%5D, t) %3E 0) %7B%0A        array%5Bi + 1%5D = array%5Bi%5D;%0A        i = i - 1;%0A      %7D%0A      array%5Bi + 1%5D = t;%0A    %7D%0A  %7D%0A%0A
   public sta

implement Arrays.sort