Blog Archives
1 2 3

01: 19 Java 8 interview Questions – Functional Programming

Java 8 interview questions & answers focusing on Functional Programming. Good handle on Java OOP concepts and FP concepts are very important NOT only from writing quality code perspective, but also from job interviews perspective to be able to do well in written tests & technical interviews.

Q1. Can you explain your understanding of Functional Programming (FP)?…



02: Java 8 Streams, lambdas, intermediate vs terminal ops, and lazy loading with simple examples

A stream is an infinite sequence of consumable elements (i.e a data structure) for the consumption of an operation or iteration. Any Collection<T> can be exposed as a stream. It…



03: Functional interfaces and Lambda expressions Q&A

The functional interfaces and Lambda expressions are going to make your code concise when coding with Java 8. These are the most awaited features among Java developers. If you understand the…



04: Convert Lists to Maps and Maps to Lists with Java 8 power

Why convert from a list to a map? Maps allow you to store and access data by a “KEY”. Lists only allow you to access data by either index or…



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 assigning x to x + 5.…



05: Finding the 2nd highest number in an array in Java

Requirements gathering

  1. Does the array allow duplicates?
  2. If duplicates are allowed, then do you need to report duplicates? For example, in {2,4, 6, 3, 6, 5}, is 6 or 5 the second highest?

Analysis

  • If duplicates are not allowed, sort the array (Arrays.sort(…)) and get the second last element, which executes in O(nlogn)
  • If duplicates are allowed, loop through each element have two variables to store highest & second highest values.


06: Java 8 way of File reading and functionally processing the data



06: Understanding TimeZones with Java 8 examples

What is UTC? which stands for Coordinated Universal Time. The diagram below shows the standard time offsets of different countries. Some places observe daylight saving time (DST) during their respective summer periods. For example,

Los Angeles (i.e LA) UTC – 8.0 hours (without DST) & UTC – 7.0 hours (with DST)

Berlin UTC + 3.0 hours (without DST) & UTC + 2.0 hours (with DST).…



07: Java 8 API examples using lambda expressions and functional programming

Java 8 API examples using lambda expressions and functional programming. Example 1: The java.lang.Runnable interface has been made a functional interface.



08: Write code to add, subtract, multiply, and divide given numbers?

A trivial coding example (i.e. a Calculator) tackled using the following programming paradigms in Java not only to perform well in coding interviews, but also to learn these programming paradigms.

Approach 1: Procedural Programming
Approaches 2 – 4: Object Oriented Programming
Approach 5: Functional Programming (Java 8)

Approach 1: Procedural



1 2 3

800+ Java & Big Data Interview Q&As

200+ Java & Big Data Tutorials

Top