Pattern Matching

Combating Fallacy in Scala: Part 1

Reading Time: 3 minutes Hi everyone, I am going to start a blog series related to Scala. This is going to be a bit different as it focuses on things such as some mistakes that we usually do, unknowingly or some concepts that we might not know. So this series is all about exploring Scala and Combating Fallacy in Scala. if you want to be a part then stay Continue Reading

Pattern Match Anything in Scala

Reading Time: 7 minutes What is Pattern Matching? Pattern matching is a powerful feature of the Scala language. It is a mechanism for checking a value against a pattern. A successful match deconstructs the value into its constituent parts. Pattern matching allows for more concise and readable code while at the same time provide the ability to match elements against complex patterns. In this blog, we will see the Continue Reading

Scala Extractors

Scala: Extractors and Pattern Matching

Reading Time: 3 minutes An extractor in Scala is an object which has an unapply method as one of its members. Often, the extractor object also defines a method apply for building values, but this is not required. An apply method is like a constructor which takes arguments and creates an object, the unapply method takes an object and tries to give back the arguments. The unapply method reverses the construction procedure of the Continue Reading

Scala Extractors

Back2Basics: Scala Extractors in Detail

Reading Time: 5 minutes While working with the Case Classes closely, we have a very concise way to decompose an entity using pattern matching. The potent example is pattern matching on the Some(x) and None, as most of us know they are case class and case object respectively. The potential question that we have is do we have a provision to use similar patterns without having an associated case Continue Reading