Blog Archives

03: Java FP composing functions example – calculate discount

FP – calculate the invoice price Invoice Price = (markedPrice * (100 – discountRate)/100) + deliveryCharge Example

“f.andThen(g)” is the composition of functions. This can be described as g(f()) where f() is 270.0 (i.e. 300.00 * (100 – 10)/100), and g(f()) is 270.00 + 50.00 = 320.00; DiscountCalaculator that…...

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 Feel free to evaluate the quality of the contents Free FAQs | HomeTry Log In | Register
Posted in member-paid, OOP vs FP Coding Java 8

04b: 6 Java FP partial functions & currying interview Q&As

Q1. The “java.util.function” package only have “Function<T,R&rt;“, which takes an input and returns an output, and “BiFunction<T,U,R>“, which takes two inputs and returns an output. How would you then use a function with 3 or more input arguments? A1. If you are using three arguments then for example say 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 Feel free to evaluate the quality of the contents Free FAQs | HomeTry Log In | Register
Posted in FP, member-paid

02: OOP vs FP with Java example – Conversion strategy pattern

Java code to convert given input values from KM to Meter, Meter to Centimetres, etc. OOP approach using the strategy design pattern Step 1: Define an interface.

Step 2: Define a generic “MyMetricConverter” that implements the “Converter”.

Step 3: Define different strategy classes that return different conversion rates.…...

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 Feel free to evaluate the quality of the contents Free FAQs | HomeTry Log In | Register
Posted in member-paid, OOP vs FP Coding Java 8

01: OOP vs FP with Java example – placing a trade

A Trade goes through 3 state changes – placed, filled, and settled. Let’s solve this simple problem using both OOP & FP approaches. Place –> Fill –> Settle

OOP approach by mutating the state State changes are maintained via a variable named “status“, which is mutable. Here is the

Read more ›

Posted in OOP vs FP Coding Java 8

08: 4 Java FP Monads interview Q&As with examples

Q01. What is a monad? A01. Monad is a wrapper (or a context) that flattens the result so that it can be further processed by mapping over each element. Everything that’s a monad is a functor with extra operation to flatten the results with “flatMap” or “join”.

Using a…...

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 Feel free to evaluate the quality of the contents Free FAQs | HomeTry Log In | Register
Posted in FP, member-paid

07: 4 Java FP Functors Interview Q&As

Q01. What do you understand by the terms functors, monads, and applicatives ? A01. Functors, Monads, and Applicatives are concepts or patterns that abstract complexities in computations, and are NOT interfaces or classes. You can think of them as container type classes like List<T>, Option<T>, Futures<T>, MyContainer<T>, etc that fulfil…...

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 Feel free to evaluate the quality of the contents Free FAQs | HomeTry Log In | Register
Posted in FP, member-paid

06: 5 Java FP interview Q&As on category theory & monoids

Q01. What is a category theory from a functional programming language perspective? A01. The category theory is all about abstracting complexities in computations. OO is good for abstracting over Data, and FP is good for abstracting over behavior. Composition “f” and “g” are functions, and “A” and “B” are types.

Read more ›

Posted in FP

05: ♥ 7 Java FP (lambda expressions) real life examples in wrangling normal & big data

This post extends Transforming your thinking from OOP to FP. In Big-data, functional programming is prevalent when working with data sets. For example, writing a Spark job to work with RDDs (Resilient Distributed Data sets). In Imperative (E.g. OOP, procedural programming, etc) programming you can say

where you are

Read more ›

Posted in FP, Java 8
Page 1 of 212

Take the road less travelled

Fast-track by empowering yourself to choose from multiple job offers, open more doors and increase your earning potential.

800+ Java Interview Q&As – ♥ Free | ♦ FAQs

open all | close all

Pressed for time? 200+ Quick Prep

open all | close all

16 Java Key Areas to be a top-notch

open all | close all

100+ Java Tutorials – Step by step

open all | close all

100+ Java Coding Exercises

open all | close all

How good are your

open all | close all