Delve into the distinctions between isEmpty() and isBlank() when working with Java Strings.
Luis Javier Peris
Javier is a computer science engineer with more than 12 years of experience. Passionate about product development under agile and devops principles, having exercised the role of Scrum Master and Agile Coach for more than 10 years. His other great passion is software craftsmanship with a focus on clean code, DDD, hexagonal architecture and great testing practices.
Here's what I've reviewed (so far):
- Core Java (11)
- Persistence (8)
- Java IO (8)
- Spring Data (7)
- Java (7)
- Spring (6)
- Java String (6)
- Spring Boot (4)
- Java Dates (4)
- Spring Persistence (3)
- REST (3)
- NoSQL (3)
- Gradle (3)
- Spring Security (2)
- Spring Cloud (2)
- Java Numbers (2)
- Java Concurrency (2)
- Jackson (2)
- HTTP Client-Side (2)
- Data (2)
- Testing (1)
- Spring Web (1)
- Security (1)
- Reactive (1)
- Networking (1)
- Maven (1)
- Logging (1)
- Java Web (1)
- Java Streams (1)
- Java Map (1)
- Java Array (1)
- JSON (1)
- Docker (1)
Learn about Kafka consumer groups and their role in enhancing scalability by enabling multiple consumers to read from the same topic in parallel.
The NoSuchElementException exception occurs when accessing an element that doesn’t exist. Find out the best practices of avoiding it and writing robust code.
Learn how to convert a file into a byte array in Java.
Learn how to obtain the first date of the current month in Java using JDK classes and third-party libraries like Joda Time.
Learn how to check if a string contains a number in Java.
Learn how to capitalize the initial character of each word in a Java string.
Explore how to convert a char array to an int array in Java.
Compare Java’s Double to BigDecimal and learn about their differences.
This article summarizes naming conventions for Java interfaces, emphasizing the use of adjectives for capability interfaces and nouns for polymorphic interfaces. It provides a practical example and warns against patterns like IUser and UserImpl for code clarity. Adhering to these conventions enhances code readability and maintainability.
Explore common causes like incorrect library names, missing directory specifications, and incompatible architectures. Implement solutions such as setting java.library.path and using proper classloaders to resolve this error effectively.
Discover how to find the last day of a month in Java using both core Java methods and popular libraries. This article provides step-by-step explanations for accomplishing the task using Date and Calendar classes, Java 8’s Date Time API, and the Joda Time library with code examples and test cases.
In this tutorial, we explore Java libraries for extracting tar archives: Apache Commons Compression, Apache Ant, and Apache VFS. The article provides concise code snippets and highlights the key features of each approach. Read on to learn efficient ways of extracting tar archives in Java.
In this short tutorial, we discuss various methods of adding one month to the current date in Java. We cover using core Java methods as well as popular external libraries such as Joda-Time and Apache Commons Lang3.
This article delves into the similarities and differences between the findBy and findOneBy prefixes in Spring Data JPA. It explores the concept of derived query methods, provides code examples, and explains the exception thrown by findBy queries when the result size doesn’t match expectations.
Learn how to compress images in Java using built-in libraries and Apache Commons Imaging. Image compression reduces file size without compromising visual quality. It optimizes image-heavy applications and websites for faster loading and better user experience.
In this tutorial, we’ll explore handling the ‘NoSuchElementException: No line found’ exception when reading a file using the Scanner class in Java. We’ll explain its root cause and present three solutions: defensive programming, exception handling, and checking file emptiness.
This article delves into the difference between the next() and nextLine() methods of the Scanner class.The article also covers the use of custom delimiters and provides code examples for better understanding. Understanding these distinctions enables developers to parse input effectively using Scanner.
This article provides several ways of converting a PrintStream to a String in Java.The approaches include using ByteArrayOutputStream, a custom output stream, and Apache Commons IO.
This tutorial explains the exception org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement expected “identifier”. It provides a practical example to reproduce the exception and showcases how to fix it by double-quoting the keyword or using a JDBC URL workaround. It also covers how to automatically quote all database identifiers when using Hibernate.
This tutorial explains different ways to check if the first character of a string is a number in Java. It covers using charAt(), Character.isDigit(), Pattern class, and matches() method. It also demonstrates how to use Guava’s CharMatcher utility class to accomplish the same objective.
This article discusses the challenges of passing many arguments to a method in Java. It presents two design patterns to mitigate these issues: the Parameter Object Pattern and the Java Bean Pattern.
This article introduces the @StandardException annotation in Java’s Lombok library that generates constructors for exception classes, avoiding writing duplicate code.
Learn how to fix a common JsonMappingException when deserializing a JSON string.
This article explains how to fix the “PropertyReferenceException: No property found for type” in Spring Data JPA. It advises using exact property names when defining query methods to avoid the exception. Practical examples are provided.
This article explains how to use Hibernate annotations @CreationTimestamp and @UpdateTimestamp to track the creation and update timestamps of an entity in a Java application using the Hibernate framework.
A brief introduction to QuestDB, a column-oriented database designed for time-series and event data, and how to create, query and remove data.
Learn how to configure multiple listeners for the same Kafka topic using Spring Boot.
Learn how to change the Swagger-UI URL prefix when using Springfox and how to set up the REST API documentation using OpenAPI 3.0 with redirections.
Learn different ways of setting up a URL using Spring Cloud FeignClient.
A comparison between sequential IDs and UUIDs used as primary keys.
A comparison between the Java compiler and the Eclipse compiler.
Different ways of implementing toString for enums.
Explanation of the reason behind EmptyResultDataAccessException when jdbcTemplate is used and how to fix it.
An explanation of the RabbitMQ messaging model. Learn how to create a queue and make it dynamic.
What’s the concept of AOT and how is applied in Spring 6 looking at pros and cons.
How to convert a byte array into a class which implements the Spring MultiPartFile interface.
Why IllegalArgumentException is thrown and how to fix in it in Java.
A brief comparison between class and instance methods in Java.
A comparison between two classes to output content: PrintWriter and PrintStream, explaining the similarities and differences between them.
This is a short tutorial about how to stream a large file to a file using a DataBuffer and what’s the role of ExchangeStrategies in WebClient.
A reminder of what an anonymous class is and how to convert it to a lambda expression.
A detailed explanation about generics, how and when to use type parameters, and when wildcards are more appropiate.
A brief introductory guide to the Blaze criteria API reviewing the basic parts of queries and also how to use views.
Explore different ways to implement case-insensitive enum mapping in Spring Boot.
Learn how to access MBeans from a shell script.
Learn how to insert HashMap into MongoDB.
Learn various ways of limiting the request per second of a web client.
Learn what waiting and parking mean for a thread.
How to send array data using x-www-form-urlencoded via Postman.
A comparison between Redis Cluster and Redis Sentinel going through some basic concepts.
Learn about variables in Postman.
Learn how to generate unique random numbers efficiently.
Learn how to transform UNIX time to Date depending on the Java version.
Learn how to compare characters in Java.
What are locked ownable synchronizers and how to read a thread dump using them.
How batch operation can increased insert performance.
How to read JSON from a URL using core java libraries and third-party libraries.
Uses and differences between @ApiOperation and @ApiResponse.
Different ways of setting up a MongoDB connection.
A short article explaining the differences between static and instance instantiation.
Different ways of counting documents using Spring Data MongoDB.
Different ways of serializing entity ids when using Spring Data Rest.
A step by step guide to test the authentication of a Spring Boot app using Keycloak
Different ways to create unique fields via indexes with Spring Data.
Explanation about detached entities, why occurs the”Detached Entity Passed to Persist” error occurs and how to prevent it.
Understand the generate() and create() methods of the Flux API.
Simple and compound index, generated and custom ids in MongoDB exemplified by a Spring Data Mongo application.
Why it’s not a good idea to test a private method and how to do it if it’s extremely necessary.
An explanation about transactions and a practical example of different approaches to handle read-only transactions.
How to start up an application with a specific profile using Docker.
Local and remote Gradle build cache and how to clear them.
Spring Security handlers for exceptions.
How to use Jackson’s type inference.
Different ways to convert a boolean to an integer.
Comparison between Liquibase and Flyway.
How to solve “variable might not have been initialized” in Java.
Learn how to use Nginx as a forward proxy for any requested location.
Understand the difference between sourceCompatiblity and targetCompatibility Gradle parameters.
An example of Zuul filter creation.
Learn how to print thread info using Log4j2
A comparison between the @see and @link Javadoc annotations.
Learn how to add a handler event to a button for a JavaFX interface.
Learn how to test an LDAP server using a Java client
Learn how to convert a Maven build to a Gradle build.
Learn about the history of Java.
Learn how to convert a String to float and vice versa.
Learn how to add parameters to HttpClient requests.