javadba javadba - 1 month ago 9
Scala Question

Automatically filling in data types for <CollectionType>.empty[] in Intellij

The following type of code is quite frequent in

scala
method parameters:

events: Map[BpmId, Seq[BpmEvent]] = Map.empty[BpmId, Seq[BpmEvent]],


So theoretically after having provided the type information and the
Map.empty
the IDE should be able to fill in the rest for us:

events: Map[BpmId, Seq[BpmEvent]] = Map.empty[**IDE fills in the types for us**],


However I have not discovered an Intellij built-in or plugin function to provide that feature. Is there such an animal?

Answer

For method arguments, the use of Map() as a default empty-Map value is an option. Type information is preserved.