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
How to Use partitioningBy Collector in Java Stream API

How to Use partitioningBy Collector in Java Stream API

Hey, tea lovers! Today I will be talking about the partitioningBy Collector method of Stream API. I will be focusing on what is partitioningBy by method, where, and how to use it with different examples. I have already discussed How to use groupingBy Collector in Java Streams. Both partitioningBy and groupingBy are the java.util.stream.Collectors. partitioningBy is a terminal operation of the Stream API pipeline. ...

January 22, 2021 路 5 min 路 Imran Shaikh
Most Loved Interview Question _ Comparator vs Comparable

Interview Question: Comparable vs Comparator

Hey, Tea Lovers! Today let鈥檚 look at the most asked interview question, Comparable vs Comparator. Both beginners and experienced people get this question in their interviews. This post is one of the many in the series of Interview Questions, where we don鈥檛 just hang you with one line answer, but rather try to explain it so that it gets fits into your head. I know you are in a hurry to prepare for the interview, so I will make this post as short as possible, So prepare your cup of tea to sip and code. ...

November 14, 2020 路 11 min 路 Mahesh More
How to use groupingBy Collector in Java Streams

How to use groupingBy Collector in Java Streams

Hey, Tea lovers! Today we will talk about the groupingBy Collector method of Java Stream API. Yes, it is similar to GROUP BY of SQL since it groups and collects the objects based on a given condition or value. In case you want to get familiar with the Stream API, I recommend you to read the post " Be More Functional with Java鈥檚 Functional Interfaces" and " Stream API: The Hero Without a Cape". These will help you understand the post and might refresh your memory if you already know. Prepare your tea then, to sip and code. ...

October 15, 2020 路 5 min 路 Imran Shaikh
Basic to Advance ways to iterate over a List in Java (1)

Basic to Advance ways to iterate over a List in Java

Hey, Tea Lovers! Collection Framework is a very powerful library in Java. Every update in Java adds some more interesting features to this. Today, we will go over how you can iterate over a List, be it ArrayList, LinkedList, or any other. We will take a look at them in ascending order from the basic loop to iteration to Stream API. And also, figure out which one is best suitable for our requirements. So, make your tea and get ready to sip and code. ...

August 27, 2020 路 5 min 路 Imran Shaikh
Stream API The Hero Without a Cape

Stream API: The Hero Without a Cape

Hey Tea Lovers! In this post, we will be talking about an unsung hero of the Java world, the Stream API which was added to Java 8 and has changed the way we do programs in java and how! It added neatness as well as made the program more readable. It helps you do functional programming in Java. Without any further ado, let us read more about this jewel. What is Stream API The Stream API, included in Java 8, is utilized for processing聽collections of objects. It is the flow of Objets on which various methods get applied in the pipeline to have the result. Simply put, it flows through the given聽Collection<Object>聽and applies the different methods on the聽Object聽to aggregate them into the desired result without affecting the original聽Object. ...

May 11, 2020 路 9 min 路 Imran Shaikh