Home » Java » Page 3


How to create immutable Map in Java

Hello Friends, In this tutorial, we will see how we can create an immutable Map in Java. – What does it mean by immutable class or object? – What is an Immutable Map? – How to create an immutable Map in java? What does it mean by immutable class or object? An immutable class or object is a class or ...

Read More »

New features between Java 8 and Java 14

Since version 9, Java has new features every 6 months and it’s very hard to keep track of these new changes. Most of the information on the internet describes changes between the last 2 Java versions. However, if you’re in a similar situation as me, you’re not using the last Java version but a version several releases older. Then it’s ...

Read More »

Prefixed Naming

If you look at the source code of Takes or Cactoos for the first time, you most probably, like many others, will be triggered by the naming convention, which implies that most class names have two-letter prefixes: BkSafe, RqFake, RsWithStatus, TkGzip, and so on. To be honest, I haven’t seen a single Java developer who would be comfortable with this ...

Read More »

Call That An Exception?

While this is a Java example to do with testing and wiremock, it relates to a more universal problem. We were trying to retry Wiremock’s verify method, which may be called by our test before the endpoint we’re checking is hit. In that situation, we’d want to try again a few seconds later in a loop until timing out. Interesting, ...

Read More »

CUBA: Getting Ready for Production


“It works on my local machine!” Nowadays it sounds like a meme, but the problem “development environment vs production environment” still exists. As a developer, you should always keep in mind that your application will start working in the production environment one day. In this article, we will talk about some CUBA-specific things that will help you to avoid problems ...

Read More »

Mythematical Codey Code

Consider the following snippet: int max = 10; int a = 0; while (true) { // do a thing that may result in an early return if (++a >= max) { break; } } throw new RuntimeException("It ran out of attempts"); There are a few WTFs in the above. The loop’s a bit weird, the flow of control seems to ...

Read More »

ZeptoN is Putting Program into Java

1. Introduction The Java programming language or “Java” was introduced in 1995. Yet in the almost quarter-century it has added features not originally in the core language. Such features include enumerations, generics, many enhancements to the basic C-style functional switch statement, assertions, etcetera. Java is a programming language that has evolved over time to meet the needs of Java software ...

Read More »

Explode a WAR File Recursively

Abstract Ever need to explode a WAR file as well as exploding all JAR files in the WAR file? Ya, me too! I wrote ferris-war-exploder to explode either: A JAR fileA WAR file which every JAR file it finds also exploded.An EAR file with every JAR file (see #1) and WAR file (see #2) also exploded. Basically, ferris-war-exploder explodes anything ...

Read More »