Day: February 9, 2023

Collections – Seq, Set and Map

As part of this topic we will see one of the important topics for building Spark applications using Scala i.e Collections. Collections Scala collections are categorized into 3 types Seq Set Map Seq Sequence have length Elements in Sequence can be accessed using prefix eg: scala.Array, scala.collection.immutable.List etc Classes are divided into Seq classes and Buffer …

Collections – Seq, Set and Map Read More »

Object Oriented Concepts – Case Classes

As part of this topic, we will cover Case Classes in Scala Case Class Case classes can be pattern matched Case classes automatically define hashcode and equals Case classes automatically define getter methods for the constructor arguments(if we use var in the argument). Example case class Order(var orderId:Int,var orderDate:String,var orderCustomerId:Int,var orderStatus:String) { println(“I am inside …

Object Oriented Concepts – Case Classes Read More »

Object Oriented Concepts – Classes

In this topic we will see Object Oriented Concepts – Classes Defining a class To define a class in Scala we declare keyword class in front of identifier. Class names should be capitalized.syntax class className Example class Order(orderId: Int, orderDate: String, orderCustomerId: Int, orderStatus: String) { println(“I am inside Order Constructor”) } Disassemble and Decompile Scala code Use the javap command …

Object Oriented Concepts – Classes Read More »

Functions

In this topic, we will see what are Functions and Anonymous Functions. Functions Let us understand more about Functions in Scala. A function is a group of statements that perform a task We need to give function name, arguments and argument types for regular functions Functions are expressions (not statements) Functions can be returned, passed …

Functions Read More »