Blog Archives

01: Coding Scala Way – Java Vs Scala

Example #1: Read from a list & write to a list Java Way Output: List(Java Programming, Scala Programming, Ruby Programming) Scala Way: Using the “map” functional combinator Immutable code as shown below using the “map” function. Scala Way: Using recursion…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

01: Q1 – Q6 ♥ Scala interview questions & answers – FP

100+ FAQ Scala interview questions answered with code. Learn more about FP – 6 tips to transforming your thinking from OOP/imperative programming to functional programming (i.e. FP). Scala is very popular in Bigdata. 70+ FAQ Bigdata & Hadoop interview questions

Posted in Scala Q&As

02: Coding Scala Way – Recursion & Iterator in FP

This extends Coding Scala Way – Part 1 Example #4: FP using both recursion and functional combinator like foldLeft Can you write the following code written in Java the Scala way? Java coding question on recursion and generics 1. Define…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

02: Q6 – Q12 Scala FP currying, closures & partial functions interview Q&As

This extends Q1 – Q5 Scala Functional Programming basics interview questions & answers Q6. What is a curried function in Scala? A6. Currying is the technique of transforming a function with multiple arguments into a function with just one argument,…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

03: Coding Scala Way – Lazy Eval

Example #6: Lazy initialization & evaluation of code Scala support “views“, which are collections that can be lazily evaluated. One use for views is when you need to traverse a collection of values which are expensive to compute and you…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

03: Q13 – Q18 Scala FP combinators interview questions & answers

Q13. What are the different approaches in Scala to solve the following task? Given numbers 1 to 6, and you need to extract out the odd numbers and double them, and finally print the result. A13. There are 3 ways…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

04: ♥ Coding Scala Way – Null checks with Option-Some-None

Example #10: Null checks with “Option-Some-None” Nulls in Scala is a code smell, and a better way to handle null values is with an “Option“, which has 2 sub classes “Some” that has a value and a “None” that does

Posted in Scala way of coding

04: Q19 – Q26 Scala Data Structures basics interview questions & answers

Q19. What is the use of Tuples in Scala? A19. A Tuple is an immutable collection that can hold objects of different types. In other words, it groups together logical collections of items without using a class. There are 22…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

05: ♥ Coding Scala Way – FP concepts

Example #13: Explain the concepts Can you explain the Scala concepts applied in the following code snippets? 1. Higher Order Functions: “Line 10” is a higher order function as the function returns another function i.e. List[T] => List[R] is returned.

Posted in Scala way of coding

05: Q27 – Q32 Scala idioms Q&As on Option-Some-None, Try-Success-Failure and Either-Left-Right

Java has idioms like Try-Catch-Finally, Scala has idioms like 1) “Option-Some-None”, 2) Either-Left-Right 3) Try-Success-Failure. Q27. How does Scala try to solve the problem of getting rid of null values & the “NullPointerException”? A27. Scala provides its own type for…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

06: Coding Scala Way – Reduce & Compose functions

Example #14: Reduce operations Given a list of functions as shown below, how will you go about applying all the functions in the list to each input number and sum the result of each function? For example, applying all 3…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

06: Q33 – Q40 Scala Futures and Promises Interview Q&As

Q33. What is a “Future” object in Scala? Is it an immutable object? A33. A Future is a holder object that holds a value (i.e. success scenario) or an exception (i.e. failure) which may become available at some point. Future…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

07: Coding Scala Way – Regular Expressions

Example #16: Regular Expression Regular expression (aka regex) to identify numbers in a string. Invoking “findFirstIn” and “findAll” functions of the “Regex” class. “[0-9]+”.r is a short form instead of instantiating it as new Regex(“[0-9]+”). Output Example #17: Pattern matching…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

07: Q41 – Q48 Scala Async and Actor System Interview Q&As

Q41. What is the purpose of the “async” macro in Scala? A41. The 2.11 and later versions of Scala include the ability to transform code during compilation by using macros. The “async” macro is one of them, which transforms sequential…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

08: ♥ Coding Scala Way – Recursion & Higher Order Function

Example #20: nth Fibonacci number Q1 What is wrong with the following recursive approach to compute the nth Fibonacci number? A1 It “hangs” for the larger values of “n” like 50. Q2 How about using an iterative approach as shown

Posted in Scala way of coding

08: Q49 – Q58 Scala Implicits Interview Q&As

Q49A. What are implicits in Scals? A49A. Implicits in Scala has two related features. 1) Implicit Parameters 2) Implicit Conversions. In both cases the Scala compiler implicitly provides extra information to prevent compile errors. 1. Implicit Parameters The code without…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

09: Coding Scala Way – Fibonacci Series

Example #22: Fibonacci series in Scala This extends determine the nth fibonacci number using Scala. In this let’s print the Fibonacci series of length n. This post is motivated by a nice post at Fibonacci Numbers in Scala. Q1 Is…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

09: Q59 – Q65 Higher Order Functions in Scala Interview Q&As

Q59. What is a higher order function, and what is the purpose of higher order functions? A59. Higher-order functions are functions that take functions as parameters. This gives you opportunities to condense and simplify code. The most used methods in…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

10: ♥ Coding Scala Way – groupBy, mapValues & identity

Java developers need to learn Coding Scala Way. Scala way of coding is quite different & you need to unlearn Java way of coding Question: Given a list of numbers, how will you group the numbers by how many times

Posted in Scala way of coding

10: Q66 – Q70 Pattern matching in Scala Interview Q&As

Q66. What is the purpose of pattern matching in Scala? A66. It is for the “flow control“. Most imperative languages support “if-then-else”, case statements, and loops like while, for, foreach, etc. Scala does support some of these, but the most…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

11: ♥ Coding Scala Way – Actors with Akka – part 1

We already saw in Java: Producer and Consumer Java Multi-threading code. This extends the tutorial “Simple Akka tutorial in Scala step by step” for setting up the environment with right plugins and libraries with Eclipse & Maven. The Akka Actors

Posted in Scala way of coding

11: Q71 – Q77 – Scala type parametrization & variance interview Q&As

Q71. What is type parameterization? A71. Type parameterization allows you to write generic classes. For example, a List[A] is a generic type and take a type parameter of “A”, which can be a String, Integer, Double, Animal, or any other…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

12: Coding Scala Way – Actors with Akka “Ask Pattern” – Part 2

Actors with Akka “Ask Pattern” is for getting a reply or a response to a message that was sent by a sender. Use ? or ask method. We saw earlier how to send or tell a message to an actor.…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

12: Q78 – Q80 Recursion in Scala Q&As explained with diagrams

Q. Do functional languages handle recursion better than non-functional ones? A. Yes because they have to. A pure function is a function with no side effects and no state. Not having side effects means you can’t have loop counters as

Posted in Scala Q&As

13: Coding Scala Way – 2 Actors with Akka – part 3

This extends Actors with Akka – part 1. This “Akka with actors” shows how messages passed among actors in the system. This is known as the reactor pattern based on the event-driven architecture. Orderplacement.scala with Actors Output: The system keeps…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

13: Q81 – Q83 ♥ Scala monoids interview Q&As

Monoids, Functors, Monads, Applicatives, etc are concepts or patterns that abstract complexities in computations, and NOT traits or classes. You can think of them as container type classes like List[T], Option[T], Futures[T], MyContainer[T], etc that fulfill requirements of functors, monads,

Posted in Scala Q&As

14: ♥ Coding Scala Way – Scala concurrency with Future

Scala concurrency with Future explains step by step blocking vs unblocking calls and how implicit and apply concepts work under the covers. Scala extends the Java programming language and runtime in many ways, including concurrency where Scala version of Future<T>

Posted in Scala way of coding

14: Q84 – Q87 Category Theory With Scala Interview Q&As

Q84. What is a category theory from a functional programming language perspective? A84. The category theory is all about abstractions. Composition “f” and “g” are functions, and “A” and “B” are types. f: A => B, means the function “f”…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

15: Coding Scala Way – Scala concurrency & closure vs function definition

This post not only covers “onSuccess” method on a “Future”, but also clarifies the difference between executing a closure and a function definition. Is anything wrong with the following Scala concurrency code? Output: “futureInc” is a closure, and the closed…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

15: Q88 – Q92 Scala Functors Interview Q&As

This extends Category Theory With Scala Interview Q&As. Q88. What do you understand by the terms functors, monads, and applicatives ? A88. Functors, Monads, and Applicatives are concepts or patterns that abstract complexities in computations, and are NOT traits or…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

16: Coding Scala Way – Scala concurrency styles

This extends Scala concurrency & closure vs function definition. This post looks at Scala concurrency styles – blocking & non-blocking. onComplete – non-blocking Output: onSuccess – non-blocking The above “onComplete” call is highly nested. “onSuccess” to the rescue. Output: for-comprehension…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala way of coding

16: Q93 – Q98 Scala monads interview Q&As

This extends Scala Functors Interview Q&As. You need to remember the following. Q93. What is a monad? A93. Monad is a wrapper (or a context) that flattens the result so that it can be further processed by mapping over each…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

17: Q99 – Q103 Scala applicatives & scalaz interview Q&As

This extends Scala Functors Interview Q&As & Scala monads interview Q&As. You need to remember the following. Q99. Why do you need an applicative functor? A99. The “map” method in the functor works with a single input argument as explained…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

18: Q104 – Q108 Scala typeclass pattern for decoupling with polymorphism

Q104. What is the importance of “typeclass” pattern in Scala? A104. Typeclass pattern is to achieve decoupling via adhoc polymorphism. Polymorphism separates interfaces from implementations, to decouple what from how. Polymorphism improves code readability with better code organization. It promotes…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

19: Q109 – Q113 Scala ADT (Algebraic Data Types) Interview Q&As

Q109 How do you model data in functional programming (i.e. FP)? A109 Using ADT (i.e. Algebraic Data Types), you can model data with logical ORs and logical ANDs. “OR” is also known as the “Sum” type, and the “AND” is…...

Members Only Content

This content is for the members with any one of the following paid subscriptions:

30-Day-Java-JEE-Career-Companion, 90-Day-Java-JEE-Career-Companion, 180-Day-Java-JEE-Career-Companion, 365-Day-Java-JEE-Career-Companion and 2-Year-Java-JEE-Career-Companion Log In | Register | Try free FAQs | Home
Posted in member-paid, Scala Q&As

Brush-up or learn the basics that will fast-track your career

open all | close all

100+ Java Tutorials by topics

open all | close all