pattern matching - Scala mutable collections and "Reference must be prefixed warnings" -
i have use mutable linked list specific use case. i'd avoid "reference must prefixed" warnings.
aliasing import seems solution:
import scala.collection.mutable.{linkedlist => mutablelinkedlist}
it works on cases except in pattern matching empty linkedlist, still produces warning:
case mutablelinkedlist() => //
the way can remove warning seems to qualified case check on empty list:
case scala.collection.mutable.linkedlist() => //
why first case not rid of warning?
just import mutable
package:
import collection.mutable
and use mutable collection:
mutable.linkedlist(1, 2, 3)
or if prefer more concise variant:
import collection.{mutable => m} m.linkedlist(1, 2, 3)
it work pattern matching also.
Comments
Post a Comment