Complete Guide to Java HashMap (with Examples)
The HashMap, part of the Java Collections framework, is used to store key-value pairs for quick and efficient storage and retrieval operations.
The HashMap, part of the Java Collections framework, is used to store key-value pairs for quick and efficient storage and retrieval operations.
The backbone of Java concurrency are threads. A thread is a lightweight process with its own call stack but can access shared data of others.
A collection is a group of objects. Java Collections framework consists of classes and interfaces to work with lists, sets, maps and queues.
This Java guide will take us through Java Collections framework. We will understand the core concepts and performing the basic operations.
Java ArrayList class represents a resizable array of objects which allows us to add, remove, find, sort and replace elements.
Lists are the core building blocks of the Collections framework. These tutorials will teach us the basics of different List classes in Java.
Maps in Java are the core building blocks of the Collections framework. These tutorials will teach the basics of working with different maps.
Learn Jackson’s default serialization and deserialization of boolean values, and how to customize it to support other possible values.
Learn to use the Maven assembly plugin for creating executable Jar files with dependencies, its various goals, descriptors using an example.
On this page, we will frequently list the major feature changes in the latest Java release, sequentially. Though we have tried to cover as much information as possible, if you know something we have missed below, please let me know, and we will add that information. Java 22 Features Java …
Learned to create a web scrapper in Java. This demo application introduces various components needed to create a working web scrapper.
Learn to set up and configure JsonPath with examples of extracting information from JSON documents by applying filters using the predicates.
Learn to make HTTP POST and PUT requests in tests with REST-assured including sending the request body, params, headers and authentication.
Learn to serialize and deserialize a Java Object to/from an XML document, using Jackson XmlMapper, with simple and easy examples.
Learn to remove the last character from a String, either using the indices or only matching criteria. Learn to handle null and empty values.
Learn to send requests with XML request body (either from an XML file or using custom objects) using REST-assured APIs with examples.
Learn to use REST-assured library to write automated tests for REST API testing with examples, specially useful in BDD style development.
Apache Cassandra is a distributed database system. This guide walks through the process of using Spring Data Cassandra with Spring Boot.
Learn to kill a running thread in Java using a boolean flag and sending interrupt message. Sending an interrupt is a much better approach.
Learn to use BlockingQueue drainTo() method for draining the queue items (polling all or specific number of elements) into a Collection.
Learn to prepare the data (to write) and then append the new rows after the last row in an existing sheet using Apache POI in Java.
Learn the different ways to set a custom name for a thread using Thread constructor and setName(). Also, learn to get the name of a thread.
Learn to read an excel file containing multiple sheets in Java using the Apache POI and SAX parser, and adding custom event handler functions.
ConcurrentMap is an interface in Java Collections and used to create a thread-safe Maps. It stores the key-value pairs in a synchronized way.
Debugging Java streams can be challenging. In this post, learn to debug streams as their elements are processed in the chained method calls.
Learn to make the main thread wait for other threads to finish using the ExecutorService or ThreadPoolExecutor methods and CountDownLatch.
Learn to configure and run a spring boot application into a docker container. Also learn the process step by step with proper code examples.
Java ternary operator is a conditional operator and can be used as a replacement for a simple if-else statement or a switch statement.
Java 21 Structured concurrency (JEP-428) aims to simplify concurrency by treating multiple tasks running in different threads as a single unit of work.
In Java, Virtual threads (JEP-425) are JVM managed light-weight threads that will help in writing high throughput concurrent applications.
TestNG is a test automation framework inspired by JUnit. It can be used for unit testing, functional, integration, and end-to-end testing.
Learn to mock the static methods (in and outside the scope) using Mockito in unit testing in Java using MockedStatic class.
Learn to create and inject mocks, record expectations, verifications, and argument matching using the JMockit in JUnit tests with examples.
Learn to use EasyMock with JUnit 4 and 5 to create test mocks, record and replay the expectations and verify method invocations on mocks.
Learn to use MockWebServer to mock APIs, later consume these API in JUnit tests using WebClient, verifying responses and servers stats.
Learn Spring Boot with the following in-depth tutorials, covering from basic to advanced concepts such as packaging and monitoring.
The microservices architecture allows us to develop, test and deploy different components of an application independently. Though such a component can be developed independently, testing this in isolation can be challenging. For a true integration testing of a microservice, we must test its interaction with other APIs. WireMock helps in …
Learn about Spring profiles, @Profile, profile-specific beans and properties, profile groups and activating a certain profile during startup.
Learn to use @PropertySource, @Value and @ConfigurationProperties annotations to register property files and inject configuration properties.
Learn to configure OAuth2 authorization-based login security in a Spring boot and spring security application with custom handlers.
Learn to partially or fully disable the Spring security in Spring boot applications based on selected runtime @Profile or using properties.
Learn to enable DEBUG and TRACE level logging for spring security configuration, request processing and filter chain proxy using simple switches.
Learn to configure and test a spring security login form based authentication that fetches the username, password and roles from the database.
Learn to pass the Spring SecurityContext instance to new threads either spawned by Spring @Async or created explicitly using new Runnable or Callable instances. 1. Default Strategy is ThreadLocal Once the AuthenticationManager completes the authentication process successfully, it stores the Authentication instance for the rest of the request in the …
Learn to create, plug in and test a custom Authentication Provider into the spring security and register with the authentication manager.
Learn the contract spring security expects from PasswordEncoder interface, inbuilt implementations and DelegatingPasswordEncoder with examples.
Java Regex or regular expressions can add, remove, isolate, and generally fold, spindle, and mutilate all kinds of text and data.
This Java logging series lists down all tutorials posted under logging frameworks such as Log4j2 and Logback, for quick references.
Log4j2 provides significant improvements over its predecessor Log4j. Read about its xml and properties configuration and various examples.
A Java array is a container object that holds a fixed number of homogeneous values (of a single type) in a contiguous memory location.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.