Mutable/immutable collections prefix convention support

As described here we should prefer the following code style for mutable and immutable collection names:

Scala plugin for IntelliJ IDEA (nightly builds) now supports this code style by default.

First of all, it brings useful code inspection, helping to migrate from different code style:

Second is class name completion and auto-import features. They both support this code style. And everywhere, where you need to import something mutable, it will be imported with such prefix according to this code style.

Third thing is that basic completion considers “import scala.collection.mutable” import as placeholder import. So there is no necessity to use class name completion everytime, when you want to use mutable completion.

And it’s not all. The last thing is that it works not only for collections. You can define any set of classes, which should support such code style.

Check “Settings -> Scala -> Imports -> Classes to use only with prefix”. Here you can add your own classes (if you have some other name clashes), or you can remove current classes (in case if you don’t want to use this code style for mutable colletions).

This entry was posted in Uncategorized. Bookmark the permalink.

2 Responses to Mutable/immutable collections prefix convention support

  1. Great feature! :-)

    I always found it a bit tiresome to manually import mutable and then keep using “mutable.HashSet”, thanks for bringing in all those nice scala specific refactors :-)

  2. OlegYch says:

    thanks, awesome idea

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">