Checking If a Method is Static Using Reflection in Java
1. Overview In this quick tutorial, we'll discuss how we can check if a method is static or not in Java by using the Reflection API. 2. Example To demonstrate this, we'll create StaticUtility class,...
View ArticleDoes a Method’s Signature Include the Return Type in Java?
1. Overview The method signature is only a subset of the entire method definition in Java. Thus, the exact anatomy of the signature may cause confusion. In this tutorial, we'll learn the elements of...
View ArticleDifference Between run, cmd and entrypoint in a Dockerfile
1. Overview In a Dockerfile, we often encounter instructions like run, cmd, or entrypoint. At first glance, they are all used for specifying and running commands. But what's the difference between...
View ArticleGet the First Key and Value From a HashMap
1. Overview In this tutorial, we'll discuss how to get the first key-value pair from a HashMap without knowing the key. First, we'll use an iterator, and then a stream to get the first entry. Finally,...
View ArticleCharacterEncodingFilter In SpringBoot
1. Overview In this article, we'll learn about CharacterEncodingFilter and it's usage in a Spring Boot application. 2. CharacterEncodingFilter CharacterEncodingFilter is a servlet filter that helps us...
View ArticleListing the Available Cipher Algorithms
1. Overview In this quick tutorial, we'll learn about the Cipher class in Java. Then, we'll see how to list the available cipher algorithms and their providers. 2. The Cipher Class The Cipher class,...
View ArticleJava Weekly, Issue 352
1. Spring and Java >> Announcing Tribuo, a Java Machine Learning library [blogs.oracle.com] Meet Tribuo: A ML library written in Java supporting classification, clustering, anomaly detection, and...
View ArticleGuide to the Gradle Wrapper
1. Overview Gradle is commonly used by developers to manage their project's build lifecycle. It's the default choice of build tool for all new Android projects. In this tutorial, we'll learn about...
View ArticleHow to Set TLS Version in Apache HttpClient
1. Introduction Apache HttpClient is a low-level, lightweight client-side HTTP library for communicating with HTTP servers. In this tutorial, we'll learn how to configure the supported Transport Layer...
View ArticleFind the Last Modified File in a Directory with Java
1. Overview In this quick tutorial, we're going to take a close look at how to find the last modified file in a specific directory in Java. First, we'll start with the legacy IO and the modern NIO...
View ArticleThe Difference Between a.getClass() and A.class in Java
1. Overview In Java, the class java.lang.Class is the entry point of all reflection operations. Once we have an object of java.lang.Class, we can then call the corresponding methods to get the objects...
View ArticleReversing a Linked List in Java
1. Introduction In this tutorial, we'll implement two linked list reversal algorithms in Java. 2. Linked List Data Structure A linked list is a linear data structure in which a pointer in each element...
View ArticleGet the Running Port in Spring Boot
1. Overview A Spring Boot application embeds a web server, and sometimes, we may want to discover the HTTP port at runtime. In this tutorial, we'll address how to get the HTTP port programmatically in...
View ArticleConditionally Run or Ignore Tests in JUnit 4
1. Overview Let's imagine we have a test for some code that depends on the Operating System and should run only if our test machine is running on Linux. If it's running on any other OS, we want the...
View Article@BeforeAll and @AfterAll in Non-Static Methods
1. Overview In this short tutorial, we're going to implement non-static methods with @BeforeAll and @AfterAll annotations available in Junit5. 2. @BeforeAll and @AfterAll in Non-Static Methods While...
View ArticleGet a List of Trusted Certificates in Java
1. Overview In this quick tutorial, we'll learn how to read a list of trusted certificates in Java through quick and practical examples. 2. Loading the KeyStore Java stores the trusted certificates in...
View ArticleReading an HTTP Response Body as a String in Java
1. Introduction In this tutorial, we'll explore several libraries for reading an HTTP response body as a string in Java. Since the first versions, Java provided the HttpURLConnection API. This includes...
View ArticleHow To Get Cookies From the Apache HttpClient Response
1. Overview In this short tutorial, we'll see how to get cookies from the Apache HttpClient response. First, we'll show how to send a custom cookie with an HttpClient request. Then, we'll see how to...
View ArticleGetting Started with jOOQ
1. Introduction In this tutorial, we're going to take a quick tour of running an application with jOOQ (Java Object Orientated Query). This library generates Java classes based on the database tables...
View ArticleJava Weekly, Issue 353
1. Spring and Java >> JEP 390: Warnings for Value-Based Classes [openjdk.java.net] One step closer to inline classes and Project Valhalla: Issue a warning when someone misuses a possible inline...
View Article