You will be surprised to know that you can also create Scala script and execute it on Windows OS(as a bat script) as well as on Linux/Unix OS(as a shell script) without any compilation.
Scala Exception handling is mostly very similar with Java exception handling except catch block syntax. Here I am just trying you to explain Scala exception handling concept in brief as it is a very vast topic in itself.
I am sure that if you have come across Java programming language, you might have used switch case statements in Java. Scala pattern matching expression is quite similar with Java switch-case statements, and provides far more features than that.
While programming in Java(earlier versions the Java 8), majority of us have come across a situation here we get
NullPointerException. It happens because many times we write a code without checking all possibilities and method returns null value under certain conditions.
Same as Java Map, Scala Map is the collection(Iterable) of various key and value pairs in Scala Collections. All keys in Map are unique and associated with a value. Same as List and Set, Scala Maps are also having two types immutable and mutable.
After the brief introduction on Scala Collections, let’s move on by looking at the List first. List is the most commonly used collection class in any programming language. List can be used same as Array but the size of list grows dynamically.
Scala collection framework is a set of very rich and user friendly collection classes. And functional capabilities of Scala makes these collections safe, easy to use, concise, fast and universal. Here in this post we’ll take an overview of Scala collection classes.
Array is a very basic building block of any programming language. Arrays can be treated as static, sequential and fixed size collection of any type in Scala. One important point to note here is ” Scala Arrays are mutable “.
In one of my previous post about Traits in Scala, I have pointed out one sentence that abstract classes and traits in Scala are Stackable. So what does that mean? Let me elaborate a bit on that part.
In my earlier post related to Traits in Scala, I have mentioned one point regarding limiting the access of trait to any class in Scala. Yes, it is possible in Scala to limit a trait such a way that it can be extended by very specific sub classes.