The contract for java.lang.Iterable interface is iterator() method which returns non-null java.util.Iterator. The latter can be empty or container with unknown size, therefore, it is not a single-line solution to get first/last item from Iterable/Iterator/Collection/Set.
Since Java 8, interface java.util.Collection has 2 additional methods: stream() and parallelStream(). There are several null-safe ways to make the stream from collection via these methods.
In addition to the default directories for deletion, maven-clean-plugin provides parameters for custom configuration.
Starting from Java 1.8 there is a new type of unchecked exception aiming to avoid explicit checking of IOException in code. This is java.io.UncheckedIOException and it extends RuntimeException.
Apache OpenNLP has predefined models for different tasks of Natural Language Processing. In this post, the analysis of POS Tagger model is presented as a debug info.
It’s a very popular task to validate opening/closing brackets (as well as parentheses) in a text or string.
In Java, a switch statement is a very convenient structure when the developer has limited set of possible values for field or variable.
Continue reading Java Switch Statement and NullPointerException
This post is about fixing “Fatal error during parsing” HTML5 by Thymeleaf with Spring Boot.
Continue reading Fix Thymeleaf HTML5 parsing in Spring Boot
Java example of how to calculate SHA-512 hash hex code of String.
Continue reading Java SHA-512 Hash Hex String
Just simple java code of how to get/calculate SHA-384 hash hex code of String.
Continue reading Java SHA-384 Hash Hex String