Put scala import before spark imports. Also, better import `scala.collection.mutable` and in the code use `mutable.HashSet` and `mutable.Set`.