Find Files by Extension in Specified Directory in Java
1. Introduction In this quick tutorial, we’ll see a few alternatives using core Java and external libraries to search for files in a directory (including sub-directories) that match a specific...
View ArticleHow to Get Last Record in Spring Data JPA
1. Overview In this short tutorial, we’ll explore different ways of getting the last record in Spring Data JPA. First, we’ll see how to do it using the Derived Queries Methods. Then, we’ll explore how...
View ArticleJava Weekly, Issue 521
1. Spring and Java >> Stream API Evolution: A Closer Look at JEP 461’s Stream Gatherers [infoq.com] Meet Stream Gatherers: helping us to keep using Stream API for more complex intermediate...
View ArticleFormat LocalDate to ISO 8601 With T and Z
1. Overview Handling date and time in a standardized format is crucial when working with applications that deal with different time zones or when exchanging data between systems. In this tutorial,...
View ArticleComparing One String With Multiple Values in One Expression in Java
1. Overview In this tutorial, we’ll discuss the various ways of finding a string among a group of strings using a single expression. Let’s assume there’s a fruit “Apple” and a group of fruits “Mango”,...
View ArticleRead a File and Split it Into Multiple Files in Java
1. Overview In this tutorial, we’ll learn how to split a large file in Java. First, we’ll compare reading files in memory with reading files using streams. Later, we’ll learn to split files based on...
View ArticleCalculate Months Between Two Dates in Java
1. Overview Calculating month intervals between dates is a common programming task. The Java standard library and third-party libraries provide classes and methods to calculate months between two...
View ArticleConvert Byte Array to JSON and Vice Versa in Java
1. Introduction The manipulation and convеrsion of data between different formats are common tasks in most programming languages. One such scenario involves converting data between a byte array and...
View ArticleComparison of for Loops and Iterators
1. Introduction for loops and Iterators, both provide mechanisms to traverse through collections of elements. While both serve the purpose of iterating over collections, they differ in their syntax,...
View ArticleHow to Write Strings to OutputStream in Java
1. Overview We often work with OutputStream when we need to transfer data to external destinations such as files and networks. Data can either be in binary or string format. We use OutputStream, which...
View ArticleParse Java Source Code and Extract Methods
1. Introduction In this article, we’re going to investigate the JavaCompiler API. We’ll see what this API is, what we can do with it, and how to use it to extract the details of methods defined in our...
View ArticleUTF-8 Validation in Java
1. Overview In data transmission, we often need to handle byte data. If the data is an encoded string instead of a binary, we often encode it in Unicode. Unicode Transformation Format-8 (UTF-8) is a...
View ArticleDifference Between execute() and submit() in Executor Service
1. Overview Multithreading and parallel processing are crucial concepts in modern application development. In Java, the Executor framework provides a way to manage and control the execution of...
View ArticlePrint a Double Value Without Scientific Notation in Java
1. Introduction In our daily tasks, we may often come across challenges to format double values. One such challenge could be printing a double value, avoiding scientific notation. Even though this...
View ArticleRotating a Java String By n Characters
1. Overview In our daily Java programming, strings are often the fundamental objects we must handle. Sometimes, we need to rotate a given string by n characters. Rotating a string involves shifting its...
View ArticleGet Client Information From HTTP Request in Java
1. Overview Web applications mainly work on the request-response model, and this model describes data exchange between a client and a web server using HTTP protocol. At the server end, which accepts or...
View ArticleSorting One List Based on Another List in Java
1. Overview Sorting a list based on the order of another list is a common task in Java, and various approaches exist to achieve this. In this tutorial, we’ll see different ways of sorting a list based...
View ArticleCheck If a Java StringBuilder Object Contains a Character
1. Introduction Thе StringBuildеr class in Java provides a flеxiblе and еfficiеnt way to manipulatе strings. In some cases, we nееd to chеck whеthеr a StringBuildеr objеct contains a specific...
View Article@Query Definitions With SpEL Support in Spring Data JPA
1. Overview SpEL stands for Spring Expression Language and is a powerful tool that can significantly enhance our interaction with Spring and provide an additional abstraction over configuration,...
View ArticleJava Weekly, Issue 522
1. Spring and Java >> Hibernate StatelessSession Upsert [vladmihalcea.com] A portable way of performing an upsert using Hibernate StatelessSession’s Upsert method. Interesting. >> This Year...
View Article