Differences Between Entities and DTOs
1. Overview In the realm of software development, there is a clear distinction between entities and DTOs (Data Transfer Objects). Understanding their precise roles and differences can help us build...
View ArticleHandling NullPointerException in findFirst() When the First Element Is Null
1. Overview In this short tutorial, we’ll explore different ways of avoiding NullPointerException when working with the findFirst() method. First, we’ll explain what causes the method to fail with...
View ArticleSkip Bytes in InputStream in Java
1. Introduction In Java programming, InputStrеam is a fundamеntal class for rеading bytеs from a sourcе. Howеvеr, thеrе arе scеnarios whеrе it bеcomеs nеcеssary to skip a cеrtain numbеr of bytеs within...
View ArticleUnreachable Statements in Java
1. Overview In this tutorial, we’ll talk about the Java specification that states that the compiler should raise an error if any statement is unreachable. An unreachable statement is a code that can...
View ArticleCreate a Mutable String in Java
1. Introduction In this tutorial, we’ll discuss a few ways to create a mutable String in Java. 2. Immutability of Strings Unlike other programming languages like C or C++, Strings are immutable in...
View ArticleConvert a Hex String to an Integer in Java
1. Introduction Converting a hexadecimal (Hex) string into an integer is a frequent task during programming, particularly when handling data types that use hexadecimal notations. In this tutorial,...
View ArticleSplitting Streams in Kafka
1. Introduction In this tutorial, we’ll explore how to dynamically route messages in Kafka Streams. Dynamic routing is particularly useful when the destination topic for a message depends on its...
View ArticleComparing the Values of Two Generic Numbers in Java
1. Introduction Java’s versatility is evident in its ability to handle generic Number objects. In this tutorial, we’ll delve into the nuances of comparing these objects, offering detailed insights and...
View ArticleSwitching Between Frames Using Selenium WebDriver in Java
1. Introduction Managing frames and iframes is a crucial skill for test automation engineers. Selenium WebDriver allows us to work with both frames and iframes in the same way. In this tutorial, we’ll...
View ArticleWhy Is sun.misc.Unsafe.park Actually Unsafe?
1. Overview Java provides certain APIs for internal use and discourages unnecessary use in other cases. The JVM developers gave the packages and classes names such as Unsafe, which should warn...
View ArticleHashSet toArray() Method in Java
1. Introduction HashSet is one of the common data structures that we can utilize in Java Collеctions. In this tutorial, we’ll dive into the toArray() method of the HashSet class, illustrating how to...
View ArticleConvert ResultSet Into Map
1. Introduction Java applications widely use the Java Database Connectivity (JDBC) API to connect and execute queries on a database. ResultSet is a tabular representation of the data extracted by these...
View ArticleMongoDB Atlas Search Using the Java Driver and Spring Data
1. Introduction In this tutorial, we’ll learn how to use Atlas Search functionalities using the Java MongoDB driver API. By the end, we’ll have a grasp on creating queries, paginating results, and...
View ArticleSharing Memory Between JVMs
1. Introduction In this tutorial, we’ll show how to share memory between two or more JVMs running on the same machine. This capability enables very fast inter-process communication since we can move...
View ArticleJava Weekly, Issue 516
1. Spring and Java >> Table partitioning with Spring and Hibernate [vladmihalcea.com] Splitting a large table into multiple smaller partition tables using Spring and Hibernate — allowing a more...
View ArticleHow to Effectively Unit Test CompletableFuture
1. Introduction CompletableFuture is a powerful tool for asynchronous programming in Java. It provides a convenient way to chain asynchronous tasks together and handle their results. It is commonly...
View ArticleGet Index of First Element Matching Boolean Using Java Streams
1. Introduction Finding the index of an element from a data structure is a common task for developers. In this tutorial, we’ll use the Java Stream API and third-party libraries to find the index of the...
View ArticleString’s Maximum Length in Java
1. Introduction Onе of thе fundamеntal data typеs in Java is thе String class, which rеprеsеnts a sеquеncе of charactеrs. Howеvеr, undеrstanding thе maximum lеngth of a String in Java is crucial for...
View ArticleSpring Kafka Trusted Packages Feature
1. Introduction In this tutorial, we’ll review the Spring Kafka trusted packages feature. We’ll see the motivation behind it, along with its usage. All with practical examples, as always. 2....
View ArticleUnderstanding NewSQL Databases
1. Overview Databases are one of the ways we store collections of data and there are different types of databases available. Different DBMSs, such as SQL and NoSQL databases, became popular based on...
View Article