Blog Archives

1. Set up environment for home coding assignments

Step 1: Setup Java, Maven, and SonarQube

1. Java: Latest possible version. Setting up Java, Maven, and eclipse.

2. Maven 3: For building. Setting up Java, Maven, and eclipse.

3. SonarQube: For code quality. SonarQube with Maven Tutorial – Code Quality for Java developers.

4. Jococo SonarQube: For unit test coverage. Jacoco for unit test coverage with SonarQube tutorial.

Step 2: Create a maven project

Press enter for all prompts to use the default values.



2. Implement an in-memory LRU cache in Java with TTL

Q: Implement an in-memory cache in Java without using any frameworks. The basic requirements are – The TTL (Time To Live) for the cache items are ~10 seconds [just for demo]. – The system has plenty of memory. – Each item may or may not be accessed during the TTL….



3. Multi-Threading – Create a simple framework where work items can be submitted

Q: Create a simple framework where work items can be submitted using Java 8 or later. Here are the use cases: #1: A work item is an instance of a class. #2: The definition of “parallelism” controls how many threads are created to execute the work items in parallel (aka…



4a. 10-digit phone number to produce a list of words matching first letters of the phone number

Q: Write a program that takes any 10-digit phone number and produces a list of words matching first letters of the phone number (2 – ABC, 3 – DEF, .. 9 – WXYZ). Use any free word list file from online. A: The logic is to 1) Read a word…



4b. FP approach 10-digit phone number to produce a list of words matching first letters of the phone number

This makes use of the Functional Programming (FP) approach. Q: Write a program that takes any 10-digit phone number and produces a list of words matching first letters of the phone number (2 – ABC, 3 – DEF, .. 9 – WXYZ). Use any free word list file from online….



5a – Writing a simple SQL where clause parser in Java – Part 1

Problem Statement: How would you go about writing an SQL WHERE clause parser to evaluate a given condition against the given data in a Hashmap. For example:



5b – Writing a simple SQL where clause parser in Java – Part 2

This extends Writing a simple SQL where clause parser in Java – Part 1. In the next post, let’s look at the parsing to an Abstract Syntax Tree (i.e. AST logic). Step 5: Firstly the Expr interface that gets implemented by different expressions.

Step …



Simple caching Java application step by step

Problem Statement: How would you go about writing application in Java where employee id to department name is cached instead of reading from a database or an API. The cache needs to be refreshed every 1 minute.

Solution, step by step

Step 1: Firstly, a simplified config class that reads config values from a “.properties” or a “.yml” file.

AppConfig.java:



300+ Java & Big Data FAQs - Quick Prep

Java & Big Data Tutorials

Top