score:0
you are on the right track, the set_val
needs to override the initial (key, value)
(if present) and start afresh (as seen from python code):
def set_val(key:string,value:string)={
if (internalstorage.contains(key))
internalstorage.remove(key); // to start fresh
internalstorage.addbinding(key,value)
}
also, as the internalstorage
is being accessed only using storage, you might want to make it private
.
private[this] val internalstorage=new hashmap[string, set[string]] with multimap[string, string]
Source: stackoverflow.com
Related Query
- Rewrite Python dict to Scala multimap (Porting code)?
- porting python to scala
- What is the best way to use python code from Scala (or Java)?
- Porting new Iterable{} code from Scala 2.7.7 to 2.8
- How to run python code with args with python -c command from scala
- How to rewrite this code in Scala using a Functional Programming approach
- Convert Apache Spark Scala code to Python
- Rewrite scala code to be more functional
- What is the equivalent scala code to this python code: "%i" % float(9.04E09)
- SparkException while porting pyspark code to scala for Spark 2.4.3
- How to convert the following scala code to python
- Calling Spark Scala Function from Python airflow dag code
- Piping Scala RDD to Python code fails
- How to get the Scala equivalent code for the Python code
- How rewrite spark scala code to use it in apache livy
- How to change the code from Scala to Python
- Spark performance for Scala vs Python
- Debugging Scala code with simple-build-tool (sbt) and IntelliJ
- Samples of Scala and Java code where Scala code looks simpler/has fewer lines?
- Drop into interpreter during arbitrary scala code location
- Scala equivalent to Python generators?
- Why does a small change to this Scala code make such a huge difference to performance?
- Using Either to process failures in Scala code
- Code Coverage Tools for Scala
- What can I do to my scala code so it will compile faster?
- Automated Java to Scala source code conversion?
- Is there a Scala equivalent for the python enumerate?
- Why is this Scala code with assignment of a val in a parameter working?
- Scala sbt console - code changes not reflected in sbt console
- Scala Process - Capture Standard Out and Exit Code
More Query from same tag
- Bring data of DataFrame back to local node for further actions (count / show) in spark/scala
- Pass Array[seq[String]] to UDF in spark scala
- i am trying to write a text file using scala in play
- Functional language implementations of Production Grade data stores
- Requests / Responses DTO objects in Play
- Typesafe Config: How resource files get merged
- Inherit .sbt files
- Unit testing with Spark dataframes
- Play Framework 2.2.x and Angular: Redirect to mobile index page
- Slick 3.1.1 not creating unique constraint
- Disadvantages of Immutable objects
- Why is my function returning a Unit instead of Int?
- Spark dataframe write method writing many small files
- Batch inserts and LAST_INSERT_ID with Slick and MariaDB
- Missing paramater type for expanded function while mapping
- Is it possible to override an implicit object contained within a trait that is being extended?
- A property over positive numbers shouldn't shrink to negative numbers
- How to cast Long to Int in Scala?
- Inheriting traits that keep types
- How to Read Json inside a Json in Spark RDD?
- How to return only the latest result of a function application on an iterator object with monad reader
- Scala - Anonymous class not getting variable of caller class
- Add element error by scala/spark
- Elasticsearch high level rest client more than 1 field search
- Create a Map from the elements of the same set based on condition in Scala
- create a big Table using HBASE client API
- Concatenate hive analog in spark
- Transient equivalent in Slick
- ClassNotFoundException when trying to connect to a postgres database through a scala/spark application
- MongoDB ObjectID as JSON using lift-json