Blog Archives
Page 2 of 10
1 2 3 4 10

01E: Scala Factory Method Pattern & Trait Vs Abstract classes

This extends the Scala Class Vs. Object and Companion object interview Q&As to implement the factory method.

Q1. What is a factory method pattern?
A1. It is an Object Oriented Programming design pattern to instantiate objects. For example,

Read more ›



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 the Trait 2.… Read more ›...

Members Only Content
Log In Register Home


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,

Read more ›



02B: Currying, partial application & functional composition in Scala

Let’s see how we can wire up functions with & without currying, and then touch on functional composition.

Without currying

Here are simple functions example that add, add10, multiply and multiplyBy10 without currying.

Output:

With currying & partial application with functional composition

Note: You can also do

Output:

What is Currying?

Read more ›



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 only need one value at a time. … Read more...

Members Only Content
Log In Register Home


Page 2 of 10
1 2 3 4 10

800+ Java Interview Q&As Menu

Top