Fading Coder

One Final Commit for the Last Sprint

Essential Guide to Java Multithreading and JUC Fundamentals

Startnig Threads by Extending the Thread Class This approach is straightforward and allows direct use of Thread class methods, but it limits inheritance because Java does not support multiple inheritance. public class WorkerThread extends Thread { @Override public void run() { for (int i = 0; i <...

8 Best Coding Practices for Creating and Destroying Objects in Java

Use static factory methods instead of public constructors Static factory methods offer multiple advantages over traditional constructors: They have descriptive names that make code more readable and self-documenting. For example, a method named getInstanceByCode makes its purpose immediately clear,...

Managing Query Performance with MyBatis Caching Layers

Session-Level Cache Every SqlSession holds an internal cache that is active by default. This local storage avoids redundant database calls when identical queries run inside the same session. Internal Mechanics The cache is backed by a Map scoped to the session. When a query arrives, MyBatis checks t...

Effective Enumeration Patterns in Modern Java Development

Java enumerations, introduced in JDK 5, represent a specialized class type designed to model fixed sets of constants. Unlike traditional constant patterns, enums provide compile-time type safety and inherent namespace management. Core Characteristics of Enumeration Types Enumeration classes automati...

Adding Background Colors and Images to PowerPoint Documents in Java

When creating PowerPoint presentations, bcakground design plays a significant role in anhancing visual appeal and maintaining consistency across slides. This article explains how to use the free Free Spire.Presentation for Java library to apply solid color backgrounds, gradient fills, and image back...

Elasticsearch Metric Aggregations: Core Usage and Examples

Elasticsearch aggregations enable powerful data summarization over search results. Among the four main aggregation types—metric, bucket, matrix, and pipeline—metric aggregations compute numeric statistics from document fields. Average Aggregation Computes the arithmetic mean of a numeric field. For...

Comparing ArrayList, LinkedList, and Vector in Java Collections

ArrayList is a resizable array implementation of the List interface. It maintains insertion order, allows null and duplicate elements, and provides fast random access. However, its not thread-safe. Insertions and deletions in the middle of the list require shifting elements, making these operations...

Mastering Concurrency Utilities in Java

The java.util.concurrent package, introduced in Java 5, is the foundation for building high-performance, scalable, and responsive multithreaded applications. This library abstracts low-level synchronization complexities into robust, production-ready utilities. Task Execution with Executors The Execu...

Installing JDK on Linux: Two Different Approaches

Installing JDK on Linux: Two Different Approaches Environment with Internet Access Using YUM to Install Search for Java-related packages 1 yum -y list java* Alternatively, 1 yum search jdk Install the JDK package 1 yum install java-1.8.0-openjdk.x86_64 Verify the installation 1 java -version The def...

Understanding Java Annotations: A Complete Guide

Java Annotations Overview What Are Annotations? Annotations in Java serve as metadata markers that can be applied to classes, fields, methods, and other program elements. They provide additional information about these elements without affecting the actual code execution. Modern Java frameworks rely...