Scala empty list

I have a member variable in the class:

val options = mutable.LinkedList[SelectOption]() 

Then I populate this list from the database.

At some point, I want to update the list. How to remove it?

In java:

 options.clear(); 

Is there an equivalent in Scala?

+7
source share
1 answer

Do not use LinkedList . This is a low-level collection that provides a data structure that can be manipulated by the user ... and responsibility.

Instead, use one of the Buffer classes that have a clear method. This method, by the way, is inherited by the Clearable , so you can just look at classes that extend Clearable .

+12
source

All Articles