Generic types allows us to abstract over types. If we don’t care what type is stored but we want to make sure we preserve the type when we get the value out, then use a generic type. Generic classes or traits takes a type parameter within a square bracket [ ]. The Scala convention is […]
Mastering Scala Basics: Modeling Data with Traits
Traits allow us to express that multiple classes share a common super-type. Traits are similar to Java’s interfaces and can be thought of abstraction over classes. // Trait declaration trait TraitName { declarationExpression } // declare class is a subtype of trait class Name(…) extends TraitName { … } Two ways that traits are different […]
Mastering Scala Basics: Objects & Classes
Just like other programming languages, we use class to create objects that have similar methods and fields. In addition, class in Scala defines a type and the objects created from a class share the same type. class Employee { val name = "John" val id: Int = 10 def details = name + ":" + […]
Mastering Scala Basics: Expressions, Types, Values & Methods
Expressions are parts of a program that evaluate to a value. For example: val a = 3 + 5 // a evaluates to 8 A value is an information stored in computer’s memory and exists at run time. In the above example, values 3 and 5 are combined to create another value 8. Types restrict […]
Passing the AWS Certified Solutions Architect – Associate Exam: A Milestone Achieved
Preparing for a certification is quite the experience, let me tell you. You think you’ve got all the knowledge in the world until you take those practice tests and realize, "Hmmm, it’s gonna take some serious work." But guess what? I passed the AWS Certified Solutions Architect – Associate exam yesterday, and let me tell […]
Mastering Java 8: A Comprehensive Tutorial
Hey folks! It’s 2020 now and Java 8 was introduced back in 2014. Yet, I still see many developers struggling with it every day. So, I’m here to help you out. I’ve written a series of blog posts to guide you in understanding Java 8, transitioning from Java 7, or just refreshing your concepts. I […]
Java 8 Aggregate Operations: A Comprehensive Guide
We use Collections not just to store objects but also to retrieve, remove and update those objects. Aggregate operations are used to perform those actions using lambda expressions. We’re going to use lambda expressions throughout this article and if you want a refresher on those I suggest you to read lambda expressions in java 8 […]
Mastering Method References in Java 8
In certain scenarios a lambda expression does nothing but call an existing method of a class. In those cases, it’s better to use the existing method by name and we can do that by using method references. We’re going to use lambda expressions throughout this article and if you want a refresher on those I […]
Exploring the Benefits of Asynchronous Programming in Java 8
Asynchronous programming refers to the occurrence of events that are independent of the main program flow and ways to deal with such events. In this article we are going to look into new ways of processing data asynchronously using CompletableFuture class. CompletableFuture implements Future and CompletionStage classes. public class CompletableFuture<T> extends Object implements Future<T>, CompletionStage<T> […]
Mastering Lambda Expressions in Java 8
Lambda expressions were introduced in Java 8. A java lambda expression is basically a function which can be created without belonging to any class. In this post we’re going to look what are lambda expressions and how to use it. This is going to be a hands-on article and all the java code in this […]