我在使用旧版哈希表时遇到了意外的问题,这是怎么回事?
Welcome to Scala version 2.8.0.final (Java HotSpot(TM) Client VM, Java 1.6.0_21).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import com.ibm.mq._
import com.ibm.mq._
scala> MQEnvironment.properties
res1: java.util.Hashtable[_, _] = {}
scala> res1.put("transport", "MQSeries")
<console>:10: error: type mismatch;
found : java.lang.String("transport")
required: ?0 where type ?0
res1.put("transport", "MQSeries")
^
PS,问题仍然存在,但是我有个不好的解决方法:
scala> new java.util.Hashtable[String, String]
res10: java.util.Hashtable[String,String] = {}
scala> res10.put("transport", "MQSeries")
res11: String = null
scala> MQEnvironment.properties = res10
scala> MQEnvironment.properties
res13: java.util.Hashtable[_, _] = {transport=MQSeries}