Type Reason Java.Lang.UnsupportedOperationException it the iterator does not support removing elements from this Collection
Removes all elements from this Collection, leaving it empty (optional). This implementation iterates over this Collection and calls the remove method on each element. If the iterator does not support removal of elements, an UnsupportedOperationException is thrown.
Concrete implementations usually can clear a Collection more efficiently and should therefore overwrite this method.