Author: Randhir kumar

Scala-Constructor-Auxillary

Auxiliary constructor in Scala

Reading Time: 3 minutes Before starting with auxiliary constructor I request you to first visit my previous blog  Primary Constructor in Scala. Scala has two types of constructor i ) primary constructor. ii ) auxiliary constructor (secondary constructor). A scala class can contain zero or more auxiliary constructor. The auxiliary constructor in Scala is used for constructor overloading and defined as a method using this name. The auxiliary constructor must Continue Reading

Scala-Constructor-Auxillary

Constructor in Scala

Reading Time: 3 minutes Scala constructor is used for creating an instance (object) of a class. Scala has two types of constructor. 1. Primary constructor 2. Auxiliary constructor In this blog, We will learn about primary constructor. A Scala class can contain one and only one primary constructor. Class definition class <class-name> (parameter-list) { } class keyword is used to create a class, with the class definition we have Continue Reading

Sorting in scala using sorted,sortBy and sortWith function

Reading Time: 4 minutes Sorting is arranging the data in ascending or descending order. Sorted data helps us searching easily. In mobile phone contacts are sorted in the alphabetic order it helps us to find easily a mobile number of any people. Scala usesTimSort, which is a hybrid of Merge Sort and Insertion Sort. Here is three sorting method of Scala. sorted Here is signature def sorted[B >: A](implicit Continue Reading