Scala - Problem using MapWrapper when upgrading from 2.7.7 to 2.8.1

I have this piece of code I inherited that works well under Scala 2.7.7 (well, replacing the import to use jcl ). But when I try to use 2.8.1 I get this error:

error: not enough arguments for constructor MapWrapper: (underlying: scala.collection.Map[String,String])collection.JavaConversions.MapWrapper[String,String]. Unspecified value parameter underlying.

Map.empty ++ new MapWrapper[String, String] {

             ^

I have google high and low, tried different things but I can't find how to modify the code to work on scala 2.8.1

Any pointers would be great.

Thanks

import scala.collection.JavaConversions.MapWrapper

object errorObj{
  def convertToStringMap(javaMap: Hashtable[String, String]) = {
    Map.empty ++ new MapWrapper[String, String] {
        def underlyinga = javaMap
    }

  }
}

Answers


MapWrapper is a class in Scala 2.8 (was a trait with abstract methods in 2.7). So, you don’t need to define the abstract method underlying anymore.

new MapWrapper[String, String](someMap)

Better yet, just import scala.collection.JavaConversions._ and let an implicit conversion turn the Java Map into a MapWrapper for you.


Need Your Help

Find elements in cell array (logical 0 or 1)

matlab cell logical

I have a cell column vector of stock symbols that are all three letters long. I need to create a column vector of the same length that returns a 1 when the symbol XYZ is present, and 0 when it is n...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.