Blog Archives
1 2 3 4 5 7

01: Coding “Java way in Scala” Vs “Scala way in Scala”

Example #1: Read from a list & write to a list

Java Way in Scala

Output: List(Java Programming, Scala Programming, Ruby Programming)

Scala Way in Scala: Using the “map” functional combinator

Immutable code as shown below using the “map”

Read more ›

01: Scala Functional Programming basics – pure functions, referential transparency, side effects, etc

Q1. What is a pure function?
A1. A pure function is a function where the following conditions are met:

1) The Input solely determines the output.

2) The function does not change its input.

3) The function does not do anything else except computing the output.

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 ›...

02: Scala FP basics: First-class function, higher order function, statements Vs expressions, immutability & recursion

This extends Scala Functional Programming basics – pure functions, referential transparency, side effects, etc.

Q1. What is a first-class function?
A1. A first-class function is a function that can be treated like a value.

1) Can be assigned to a variable as a value can be assigned to a variable.

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...

03: Q1 – Q6 Scala interview Q&As on Functional Programming

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 Apache Spark programming to process Big Data. 70+ FAQ Bigdata & Hadoop interview questions &

Read more ›

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

Read more ›

1 2 3 4 5 7

Java Interview FAQs

800+ Java Interview Q&As