AbstractCollection Class
- Collection is a hefty interface
- Convenient for clients, inconvenient for implementors
- Many methods can be implemented from others (Template method!)
- Example: toArray
public E[] toArray()
{
E[] result = new E[size()];
Iterator e = iterator();
for (int i = 0; e.hasNext(); i++)
result[i] = e.next();
return result;
}