Write a void
method named cleanList
that takes a List<String>
as an argument and modifies the list to remove
all elements that are either the empty String
(""
) or null
.
Remember that you can use remove
to remove elements from a List
, though you should be careful that you do not
remove elements from a List
while you are iterating over it (with a for
loop, for example).
You should assert
that the List
argument is not null
.
Stuck? You may find these lessons helpful: