JVM Language Learning
Final case class
Initializing search
    • Abdhesh Kumar
    • Kafka
    • Scala
    • Spark and Kafka
    • Abdhesh Kumar
    • Kafka
      • Kafka Producer
      • Kafka Consumer
      • Kafka Tuning
      • Sbt testOnly
      • Methods with variable arguments
      • Pure/Total Functions
      • Multiple ways of handling an exception in scala
      • When should you use Future, Future.successful and Future.failed
      • What is kleisli or composition of monadic functions in scala
      • For-Comprehension desugar
      • Final case class
      • Spark why should we not use inferschema=true with-dataframe
      • Easy and fast way of installing java scala and spark
      • Easy scalable and fault tolerant structured streaming from kafka to spark
      • Structured streaming kafka integration
      • Kafka stream testing

    Final case class

    Why should we make case class final?

    case class MyClass(param: String)
    class AnotherClass(param: String, anotherParam: Int) extends MyClass("anotherClass")
    
    Then you get weird behavior with equals and toString. Things like this can occur:

    println(new AnotherClass("blah", 1)  ==  new AnotherClass("blah", 2))
    
    res> true
    
    Previous
    For-Comprehension desugar
    Next
    Spark why should we not use inferschema=true with-dataframe
    © 2023 Abdhesh Kumar
    Made with Material for MkDocs