In this post I will show you how to convert XML to HTML using XSLT in Java using Saxon HE version 11 library We will add the dependency to our pom: Our sample XML will be: The XSLT we will… Read More ›
Java
Integrate with OpenAI(ChatGPT) Chat Completion API in Java using Webclient
In my previous post I showed how you can integrate with Completion API. The completion API doesnt support the ChatpGPT model. The ChatGPT model is supported in the Chat completion API. In this post we will look at integrating with… Read More ›
Integrate with OpenAI(ChatGPT) Completion API in Java using WebClient
By now you all would have heard about OpenAI and played with its famous product ChatGPT. OpenAI also provides APIs which can be used to integrate features like text completion, code generation, image generation and chat completion in your applications…. Read More ›
Java 17 – Sealed classes
Prior to Sealed Classes feature there were two ways a developer could prevent a class to be extended: by declaring the class as final where no one can extend this class. 2. by making the class package private where no… Read More ›
Java 16 – Pattern matching for instanceof
We all have used instanceof check with a subsequent cast to the desired type and in this process, we are doing two operations: validating whether the object we have is of the desired type using instanceof when the validation is… Read More ›
Java 16 – Records and Constructor
In my previous post, I introduced you to the new construct called Records which was introduced in Java 16. In this post, I will go a bit deeper into how you can override the default constructor of a record which… Read More ›
Java 16 – Records
We all, Java programmers, have complained whenever we were forced to create a class or use maps just to hold some data whilst other newer languages provided some out-of-the-box data structure for the same. Our problem has been addressed by… Read More ›
Java 15 – Text blocks
Text blocks are all about writing multi-line strings in a clean and readable way. This was added as part of JEP 378 in Java 15. One can read the detailed information of the feature from the JEP details. In this… Read More ›
Difference between Function.andThen and Function.compose
There are two different ways to mix functions in Java: using andThen using compose It is important to understand the difference between the two. andThen: function1.andThen(function2) will first apply function1 to the input and the result of this will be… Read More ›
Different ways of declaration and initialization of arrays in Java
The below code shows the different ways one can declare and initialize an Array in Java: Line 5: Declaration of array along with initialization of its values. Here it is not required to pass the size of the array. Line… Read More ›