How to Easily use Factory Design Pattern in Java

How to Easily use Factory Design Pattern in Java

Hey, Tea Lovers! Let me continue our design pattern series by adding this post. The Factory Design Pattern or Factory Method Design Pattern. It is one of the widely used and easy-to-understand Design patterns. It’s an effortless yet effective way of hiding object creation complexity. That’s why it is under the creation pattern category. So let’s jump right into it. Prerequisite to knowing Factory Design Pattern Before understanding what a factory design pattern is, you need to understand what superclass and subclass are. I am pretty sure you are aware of this detail, if not, the following section describes it in brief. if you already know it, you can skip to this part ...

August 5, 2022 · 6 min · Imran Shaikh
How HashMap Works THumbnail

The Magic Behind HashMap and How it works in Java

Hey! tea lovers! In this post, we will be discussing how HashMap, the key-value-based data structure, works in Java. And it is one of the most asked interview questions as well. It is the core feature we as a developer use daily. Primarily used for easy and faster access to data based on the key. So let us see how it stores, retrieves and updates the data. I will put more articles under the Simply Explained tag. For now, let us get started with HashMap. So make your cup of tea to sip and code. ...

March 20, 2022 · 6 min · Imran Shaikh
Call By Value & Call By Reference in Java

Call By Value & Call By Reference in Java

Hey, Tea Lovers! Today we will take a look at the basic but tricky interview question, Call By Value & Call By Reference in Java. Both beginners and experienced developers get this question in interviews. It’s a technical interviewer’s favorite question. This post is one of the many in the series of Interview Questions, where we don’t just hang you with one line answer, but rather try to explain it so that it gets fits into your head. ...

February 18, 2022 · 6 min · Mahesh More
How to use H2 DB in Core Java Project

How to use H2 DB in Core Java Project

Hey, Tea Lovers! Today let’s look at how you can use an in-memory database to test a core Java project, specifically H2 DB. The official name of H2 DB is H2 Database Engine. I will focus on it in the testing and not on the main project. I just want to give you a glimpse of how you can get started with it. I would highly recommend for the database logic or testing you shouldn’t rely upon In-Memory databases, always have Integration Test’s in this scenarios. Use this tool for a small or temporary test. ...

November 20, 2021 · 8 min · Imran Shaikh
7 Best Ways You can Loop through Lists in Java

7 Best Ways You can Loop through Lists in Java

Hey, Tea Lovers! Let’s look at the 7 ways you can iterate or loop through a Java List. These are ordered from basic to advance to pro level. So let’s jump to see different types of loops in java I will use the same list throughout all the code samples. List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 6, 7, 8, 10); Basic Level of Loops First, let’s look at the basic level of looping. These are your for-loop, while-loop, and enhanced for-loop. Let’s take a look at them one by one. ...

August 10, 2021 · 5 min · Imran Shaikh
JUnit 5 Introduction for TDD Development in Java

Java's TDD is Now Boosted with Junit5

Hey, Tea Lovers! This post is the start of a new series of posts on TDD development in Java. This will be a quick introduction to JUnit 5. It won’t be about JUnit 4 vs. JUnit 5 instead, we will be focusing entirely on JUnit 5 and how as a beginner, you can start working on it right off the bat. Let’s jump right into it. I will keep on adding more posts on the topic such as Best practices, tips, and tricks, advanced testing, and many more. So please subscribe to our newsletter for new updates. ...

August 7, 2021 · 7 min · Imran Shaikh
Convert Milliseconds to LocalDateTime in Java8 & Above

Convert Milliseconds to & from LocalDateTime in Java8 & Above

Hey, Tea lovers! This short post is about how you can easily convert the milliseconds to a LocalDateTime Object. This is a very short guide on how to create LocalDateTime via milliseconds. I will also show you the opposite, that is, converting LocalDateTime to milliseconds. Note that, if you want to convert it to LocalDate instead of LocalDateTime, the process is similar. Requirement for the Conversions Well, you will only require Java. Since LocalDateTime or LocalDate in java was introduced from Java 1.8, you will require Java 8 or higher. ...

July 31, 2021 · 3 min · Imran Shaikh
Java-Base64-How-to-Encode-and-Decode-Base64-in-Java-1

Java Base64: How to Encode and Decode Base64 in Java

Hey, Tea Lovers! In this post, we will talk about Base64 in Java. Base64 is a very common and easy way to encode data. It helps us to at least make it hard to understand the data at first glance to keep it secure. In the Java Base64 library, we have unique types of Base64 techniques which you will see in a bit. For this, we will be using the inbuilt Java Base64 Encoder and Decoder. You don’t need any additional Base64 libraries to do this simple task. ...

May 21, 2021 · 6 min · Imran Shaikh
Java-Interface-and-Various-Types-of-Interfaces-1-1

Java Interface and Various Types of Interfaces

Hey, Tea lovers! before talking about Java Interface, Have you ever heard the phrase, “Man Of Many Faces”? if not, it means a person can be of everything or anything when it comes to portraying something. It can be one thing and a minute after another without losing its strength. Java’s interface fits perfectly with this title. It is an integral part of java and has become so powerful over the years, that it shifted the way a Java programmer thinks. It has added various ways of doing things in Java. Depending on the number of methods only, an interface’s definition as well as the object-creating process changes. ...

May 14, 2021 · 5 min · Imran Shaikh
Thread Pool in Java Threads Explained

Thread Pool in Java Multi-Threading Explained

Hey, Tea Lovers! Today we will talk about the Thread Pool in Java. And how it saves resources and increases performance. And also, why we should use a thread pool in Java if we are building a multi-threaded java application? Threads in Java Before we talk about the thread pool in Java, let’s revisit threads. Threads are simple yet powerful things. By creating multiple threads, and multithreading applications, you can do tasks simultaneously. Wow, how cool and how efficient, right? But wait, if there is a heaven there is a hell. ...

April 17, 2021 · 10 min · Imran Shaikh