previous | start | next

## `AbstractCollection` Class

- `Collection` is a hefty interface
- Convenient for clients, inconvenientfor implementors
- Many methods can be implemented from others (Template method!)
- Example: `toArray
  `

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

previous | start | next