AbstractCollection Class

public E[] toArray()
{
   E[] result = new E[size()];
   Iterator e = iterator();
   for (int i = 0; e.hasNext(); i++)
      result[i] = e.next();
   return result;
}