How to Remove a Key, Value, or Entry from an HashMap in Java 8 - Example Tutorial

In the last article, I have shown how to remove key/value pairs from a map in Java-based upon some conditions like remove all entries where values are greater than some values. I have told you that you must use the Iterator's remove() method for removing mapping while iteration to avoid ConcurrentModificationException, but that's not required anymore in Java 8. From JDK 8 onwards, you can selectively remove mapping without iterating over Map. The JDK 8 API has added several new methods to existing interfaces e.g. java.util.Collection, java.util.Map, Comparator, etc because the interface can now contain concrete methods in the form of static and default methods.

What is happens-before in Java Concurrency? An example

A couple of days ago, one of my readers messaged me on LinkedIn about a Java interview question he has recently faced - what is the happens-before relationship in Java concurrency? What is the benefit of it, and how exactly it works? He kind of has some ideas about that its related to the Java Memory Model and provides some sort of visibility guaranteed but couldn't explain with conviction to his interviewer, particularly with a code example and was a bit disappointed. He then asked me if I can write an article about it. I said you should have read the Java concurrency in Practice book before the interview, that would have helped, but nonetheless, I liked the idea to just provide a quick overview of what is the happens-before relationship between threads in Java.

Top 15 Data Structures and Algorithm Interview Questions Answers for Java Programmer

Data structures and algorithm questions are an important part of any programming job interview, be it a Java interview, a C++ interview, or any other programming language. Since data structures are core programming concepts, it's mandatory for all programmers, to know basic data structures like the stack, linked list, queue, array, tree, and graph. Though trees and graphs are on the tougher side, I still see programmers get familiar will all these. Any list of programming job interview questions is incomplete without questions from data structures and algorithms. Similarly, while going on questions from data structure you may get some programming exercise as well e.g. swapping numbers without temp variable.

How to Find Multiple Missing Integers in Given Array of Numbers with Duplicates in Java?

Hello guys, It's been a long time since I have discussed any coding or algorithm interview questions, so I thought to revisit one of the most popular array-based coding problems of finding missing numbers in a given array of integers. You might have heard or seen this problem before on your programming job interviews and you might already know how to solve this problem. But, there are a lot of different versions of this problem with increasing difficulty levels which interviewers normally use to confuse candidates and further test their ability to adapt to frequent changes, which is key to surviving in the ever-changing software development world.

Top 5 Books and Courses to Crack Oracle's Java SE 11 Certification | OCAJP 11 1Z0-815 and OCPJP 11 1Z0-816, 1Z0-817

Hello guys, if you are preparing for the OCAJP 11 (1Z0-815)  or OCPJP 11 (1z0-816) exam and looking for some advice on preparation then you have come to the right place. The Java SE 11 Certification is one of the toughest of Java certification at the developer level. It's much harder than OCAJP 8, it's predecessor, and some of the programmers who have attempted it calling it even harder than the professional-level certification like OCPJP 8. In order to crack Java SE 11 certification, you need to prepare hard, but, at the same time, you also need to know which areas you should focus on. What topics should you spend more time on and which books and courses can help you to learn those essential topics?

Difference between @Component, @Service, @Controller, and @Repository in Spring

Before you learn the difference between @Component, @Service, @Controller, and @Repository annotations in the Spring framework, it's important to understand the role of @Component annotation in Spring. During the initial release of Spring, all beans are used to be declared in an XML file. For a large project, this quickly becomes a massive task, and Spring guys recognize the problem rather quickly. In later versions, they provide annotation-based dependency injection and Java-based configuration. From Spring 2.5 annotation-based dependency injection was introduced, which automatically scans and registers classes as Spring bean which is annotated using @Component annotation.