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
7 Best Ways You can Loop through Lists in Java

7 Best Ways You can Loop through Lists in Java

Hey, Tea Lovers! Let鈥檚 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鈥檚 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鈥檚 look at the basic level of looping. These are your for-loop, while-loop, and enhanced for-loop. Let鈥檚 take a look at them one by one. ...

August 10, 2021 路 5 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