Home » Java » Core Java

Core Java

JDK 16: Checking Indexes and Ranges of Longs

In my last post, I described the day period support added with JDK 16 Early Access Build 25. That same build also added methods for checking indexes and ranges of long values, which is the subject of this post. JDK-8255150 (“Add utility methods to check long indexes and ranges”) is the Enhancement used to add utility methods for checking long ...

Read More »

Static Factories are Great!

Every now and then I jump on classes with multiple constructors or classes that are rigorous to work with. Let alone not being able to mock part of their components and at the end being forced to use reflection for testing (mockito based, old school, you choose). Imagine a Producer class that you use for Kafka. A class that provides ...

Read More »

Day Period Support in JDK 16

JDK 16 Early Access Build 25 (2020/11/18) includes changes for JDK-8247781 (“Day periods support”). As stated in the JDK 16 Early Access Build 25 Release Notes (“Day period support added to java.time formats”), the new functionality “translates day periods defined in Unicode Consortium‘s CLDR.” In most English-language situations using a “12-hour clock“, the “day periods” might be used instead of ...

Read More »

Constrast DataWeave and Java mapping operations

Main points: DataWeave 2.0 provides mapping capabilitiesJava and DataWeave can achieve the same mappingsDataWeave mapping operator is less verbose than Java DataWeave map operator The DataWeave 2.0 (Mule 4) map operator shares similarities with the map() method from Java’s Stream class. Mapping is a transformative operation The idea of mapping is to transform each element of an array and output ...

Read More »

Saving JetBrains MPS models in a database using Modelix

JetBrains MPS is our tool of choice to build Domain Specific Languages targeting professionals who are not developers. MPS is a great choice but over several projects we ran into specific issues for which we are researching an answer. In this article we see how we can solve one of these issues by using Modelix to store MPS models into ...

Read More »

Permutation – Heap’s Algorithm

 This is a little bit of experimentation that I did recently to figure out a reasonable code to get all possible permutations of a set of characters.  So say given a set of characters “ABC”, my objective is to come up code which can spit out “ABC”, “ACB”, “BAC”, “BCA”, “CBA”, “CAB”.  The approach I took is to go with ...

Read More »

GC Logs changes for migrating from JDK 8 to JDK 11

Problem Moving from JDK 8 to JDK 11 is quiet subtle. One issue which many people have faced is regarding is GC Logs. Solution JDK 11 uses generic logging mechanism. So flags like PrintGCDetails, PrintGCDateStamps don’t work anymore. The new format is easy to use once you understand it. Format is : 1 [tag selection][:[output][:[decorators][:output-options]]] There are 4 sections to ...

Read More »

Java Program to Find Transpose of a Matrix

A quick and practical guide to calculate the matrix transpose in java. Transpose of a given matrix is nothing but the changing the values and order. 1. Overview In this article, you’ll learn how to find the transpose of a given matrix using a simple for loop. You can go thorough the previous articles on addition and multiplication of two ...

Read More »