private static void removeFromList(List<MutableTypes> list, Runnable setSize) {
    gcPrintUsed();

    long start = System.currentTimeMillis();
    do {
      System.out.println("Updating");
      long startWrite = System.nanoTime();
      setSize.run();
      populate(list);
      int i;
      long timeWrite = System.nanoTime() - startWrite;
      System.out.printf("Took %,d ns per object write%n", timeWrite / list.size());

      System.out.println("Removing");
      long startRemove = System.nanoTime();
      while (list.size() >= 3) {
        int size = list.size();
        // remove from the start.
        final MutableTypes mt0 = list.remove(0);
        assertEquals(size - 1, list.size());
        // remove from the middle.
        final MutableTypes mt1 = list.remove(list.size() / 2);
        assertEquals(size - 2, list.size());
        // remove from the end.
        final MutableTypes mt2 = list.remove(list.size() - 1);
        assertEquals(size - 3, list.size());
        if (list instanceof HugeArrayList) {
          HugeArrayList hal = (HugeArrayList) list;
          hal.recycle(mt2);
          hal.recycle(mt1);
          hal.recycle(mt0);
        }
//                System.out.println(list.size());
      }
      while (!list.isEmpty())
        // remove from the start.
        list.remove(0);

      long timeRemove = System.nanoTime() - startRemove;
      System.out.printf("Took %,d ns per object remove%n", timeRemove / length);

      System.gc();
    } while (System.currentTimeMillis() - start < 10 * 1000);
    System.out.println("Finished");
  }