Guide to the Java Queue Interface
1. Introduction In this tutorial, we’ll be discussing Java’s Queue interface. First, we’ll take a peek at what a Queue does, and some of its core methods. Next, we’ll dive into a number of...
View ArticleWhat is Thread-Safety and How to Achieve it?
1. Overview Java supports multithreading out of the box. This means that by running bytecode concurrently in separate worker threads the JVM is capable of improving the performance in applications....
View ArticleDifferences Between ZonedDateTime and OffsetDateTime
1. Overview ZonedDateTime and OffsetDateTime are pretty popular classes in the Java 8 DateTime API. Furthermore, both store an instant on the timeline up to a precision of nanoseconds. And, at first,...
View ArticleAttaching Values to Java Enum
1. Introduction The Java enum type provides a language-supported way to create and use constant values. By defining a finite set of values, the enum is more type-safe than constant literal variables...
View ArticleIntro to Derive4J
1. Introduction Derive4J is an annotation processor that enables various functional concepts in Java 8. In this tutorial, we’ll introduce Derive4J and the most important concepts enabled by the...
View ArticleJava instanceof Operator
1. Introduction In this quick tutorial, we’ll learn about the instanceof operator in Java. 2. What is the instanceof Operator? instanceof is a binary operator used to test if an object is of a given...
View ArticleSpring WebClient and OAuth2 Support
1. Overview Spring Security 5 provides OAuth2 support for Spring Webflux’s non-blocking WebClient class. In this tutorial, we’ll analyze different approaches to access secured resources using this...
View ArticleUsing Curl in Java
1. Overview In this tutorial, we’re going to look at how to use the curl tool inside a Java program. Curl is a networking tool used to transfer data between a server and the curl client using protocols...
View ArticleKafka Connect Example with MQTT and MongoDB
1. Overview In a previous article, we had a quick introduction to Kafka Connect, including the different types of connectors, basic features of Connect, as well as the REST API. In this tutorial, we’ll...
View ArticleEnabling TLS v1.2 in Java 7
1. Overview When it comes to SSL connections, we should be using TLSv1.2. Indeed, it’s the default SSL protocol for Java 8. And while Java 7 supports TLSv1.2, the default is TLS v1.0, which is too weak...
View ArticleDeserialize Immutable Objects with Jackson
1. Overview In this quick tutorial, we’ll show two different ways of deserializing immutable Java objects with the Jackson JSON processing library. 2. Why Do We Use Immutable Objects? An immutable...
View ArticleHow to Find JAVA_HOME
1. Introduction In this quick post, we’ll learn how to find JAVA_HOME on Windows, Mac, and Linux. As we all know, JAVA_HOME is an environment variable that we commonly use to locate java executables...
View ArticleConverting Between LocalDate and SQL Date
1. Overview In this quick tutorial, we’ll learn how to convert between java.time.LocalDate and java.sql.Date. 2. Direct Conversion To convert from LocalDate to java.sql.Date,we can simply use the...
View ArticleMap to String Conversion in Java
1. Overview In this tutorial, we’ll focus on conversion from a Map to a String and the other way around. First, we’ll see how to achieve these using core Java methods, and afterwards, we’ll use some...
View ArticleDeprecated Classes in Spring
1. Introduction In this tutorial, we’re going to take a look at the deprecated classes in Spring and Spring Boot and explain what these have been replaced with. We’ll explore classes starting from...
View ArticleJava 8 Streams peek() API
1. Introduction The Java Stream API introduces us to a powerful alternative for processing data. In this short tutorial, we’ll focus on peek(), an often misunderstood method. 2. Quick Example Let’s get...
View ArticleJava Weekly, Issue 264
Here we go… 1. Spring and Java >> Practice Mock Interviews & Coding Problems with Pramp If you’re looking to improve your interview game, definitely have a look at the Pramp mock interviews...
View ArticleSpring PostConstruct and PreDestroy Annotations
1. Introduction Spring allows us to attach custom actions to bean creation and destruction. We can, for example, do it by implementing the InitializingBean and DisposableBean interfaces. In this short...
View ArticleSetting up Lombok with Eclipse and Intellij
1. Overview Lombok is a library which facilitates many tedious tasks and reduces Java source code verbosity. Of course, we usually want to be able to use the library in an IDE, which requires...
View ArticleHow to Write to a CSV File in Java
1. Overview In this brief tutorial, we’re going to learn how to write to a CSV file using Java. CSV stands for Comma-Separated-Values and it’s a common format for doing a bulk data transfer between...
View Article