case class
comes with a copy
method that is dedicated exactly to this usage:
val newPersona = existingPersona.copy(sentMessages =
existingPersona.sentMessages + newMessage)
More Related Contents:
- error in if return in Scala
- How do I get around type erasure on Scala? Or, why can’t I get the type parameter of my collections?
- Call by name vs call by value in Scala, clarification needed
- What does the `#` operator mean in Scala?
- Automatically and Elegantly flatten DataFrame in Spark SQL
- Spark extracting values from a Row
- Scala: Merge map
- Finding type parameters via reflection in Scala 2.10?
- Defining a UDF that accepts an Array of objects in a Spark DataFrame?
- Spark / Scala: forward fill with last observation
- how do I get sbt to use a local maven proxy repository (Nexus)?
- Scala multiple type pattern matching
- Pattern matching on generic type in Scala
- What are the rules to govern underscore to define anonymous function?
- Use case of scala.concurrent.blocking
- Scala Macros: Making a Map out of fields of a class in Scala
- Apache Spark: Get number of records per partition
- Escape a dollar sign in string interpolation
- Derive multiple columns from a single column in a Spark DataFrame
- Explicit self-references with no type / difference with ”this”
- Getting the index of the current loop in Play! 2 Scala template
- How to get keys and values from MapType column in SparkSQL DataFrame
- Addition of two RDD[mllib.linalg.Vector]’s
- How can I convert immutable.Map to mutable.Map in Scala?
- Install sbt on ubuntu [closed]
- Should I use the final modifier when declaring case classes?
- Scala equivalent of Java’s Number
- Is there a simple example of how to generate verilog from Chisel3 module?
- Difference between two rows in Spark dataframe
- Run a scala code jar appear NoSuchMethodError:scala.Predef$.refArrayOps