Collectors.toMap() – Collect a stream to a map

Welcome to Java 8 series. In this tutorial, you will learn about how to collect a stream to a map using Collectors.toMap(). If you would like to learn more about Java Stream operations.Please check out this link. In this example, we will use Stream.collect() operation to perform a reduce operation on the stream of elements.i.e., in this case,we will collect a stream […]

Scala Range

Welcome to Scala series. In this tutorial, you will learn about Scala Range in detail. Scala Range is a sequence of integers or characters with a certain order or increment. It is mainly used for looping constructs. E.g Integer Range using “to” Here we are trying to create a range from 1 to 10 inclusive of 10. Integer Range using “to” with […]

Scala String Interpolation in detail

Welcome to Scala series. In this tutorial, you will learn about Scala String Interpolation in detail. Scala String interpolation brings us a different way to create a string. It allows us to create dynamic strings with dynamic values during runtime. Let us see a few examples “s” Interpolation Let us print the age dynamically rather than appending to a string as a […]

Scala case class

Welcome to Scala series. In this tutorial, you will learn about Scala case class. Case class is a special type of class. It will automatically give all boiler plate code such getters and setters by default.It is used mainly as a POJO classes similar to Java. Syntax Case class Object creation( apply() method) Usually , we will use new keyword to create […]

Scala Companion object

Welcome to Scala series. In this tutorial, you will learn about Scala Companion object. Before learning Scala companions, let us know a bit about Scala class and objects. I have already written a brief tutorial for Scala class and Scala object. Please check out those before proceeding with this tutorial. Let us see the basics of Scala Class and Object. Scala Class […]

Scala nested methods

Welcome to Scala series. This tutorial is about the Scala nested methods. A method in Scala (or in any programming language) is list of statements in a sequence order to perform a certain task. You can checkout this post to learn more about Scala methods. Syntax of a method A method can have any number of nested method inside the […]

Scala Break statement

Welcome to Scala series. In this tutorial, you will learn about Scala break statement. Break statement is common in most of the programming languages.It is essentially used to break the loop of execution. The flow of action comes out of the loop once the break statement is executed. If there are nested loops, then break statement will terminate the inner loop where […]