java

Java's missing feature: extension methods

What is an extension method? An extension method is the ability to “add” a method directly to an existing type without creating a new derived type, recompiling, or otherwise modifying the existing type. When calling an extension method, there is no significant difference compared to calling the actual method defined in the type. Why you need extension methods Consider a function that, after fetching a string containing multiple item IDs from Redis (each item ID is separated by an English comma), first de-duplicates the item IDs (and is able to maintain the order of the elements), and then finally concatenates the individual item IDs using English commas.

Java Memory Issues in Cloud Native

Java has been one of the most popular programming languages in the past two decades with its active open source community and well-established ecological advantages. Entering the cloud-native era, the booming cloud-native technology releases cloud computing dividends, drives business to cloud-native transformation, and accelerates the digital transformation of enterprises. However, Java’s cloud-native transformation path faces great challenges, and there are many contradictions between Java’s operation mechanism and cloud-native features. Enterprises are leveraging cloud-native technology for deep cost optimization, and resource cost management has been raised to an unprecedented level.

Detailed explanation of JAVA thread problem diagnosis tool Thread Dump

Thread Dump is a very useful tool for diagnosing problems with Java applications. Every Java virtual machine has the ability to generate a thread-dump of the state of all threads at a given point in time. Although the thread dump printed by each Java virtual machine varies slightly, most of them provide a snapshot of the currently active thread and a stack trace of all Java threads in the JVM. The stack information usually contains the full class name and the methods executed and, if possible, the source code line number.

Found a bug in MapStruct expressions

Preface MapStruct is a code generator that greatly simplifies the implementation of mappings between Java Bean types based on a conventionally preferred approach to configuration. The generated mapping code uses simple method calls, so it is fast, type-safe and easy to understand. mapStruct’s expression function is designed to deal with the mapping of special object properties, such as the DTO status property into PO status requires further processing, this time you need to use the expression function.

Getting Started with JavaParser: Analyzing Java Code Programmatically

The JavaParser library provides an abstract syntax tree for Java code. The AST structure allows you to use Java code in a simple programmatic way. When using JavaParser, we usually want to perform a series of operations at a time. Usually, we want to operate on the entire project, so given a directory, we will explore all Java files. This class should help to accomplish the following operations. import java.io.File; public class DirExplorer { public interface FileHandler { void handle(int level, String path, File file); } public interface Filter { boolean interested(int level, String path, File file); } private FileHandler fileHandler; private Filter filter; public DirExplorer(Filter filter, FileHandler fileHandler) { this.

Java Containerization Guide

I. System selection About the most basic underlying image, usually most of us have only three choices: Alpine, Debian, CentOS; of these three for the operation and maintenance of the most familiar with the general CentOS, but unfortunately CentOS later no longer exists in a stable version, about its stability has been a mysterious problem; this is a matter of opinion, I Personally, I don’t use it if I can 😆.

Java19 Official GA! See how virtual threads can dramatically increase system throughput

Java19 was released yesterday, bringing a new feature that Java developers have been waiting for - virtual threads. Before Java had this new feature, Golang’s Goroutine had been popular for a long time, and it was a big hit in the field of concurrent programming. With the rapid development and promotion of Golang, it seems that coroutine has become one of the necessary features of the best languages in the world.

JDK 19 / Java 19 Official GA

JDK 19 / Java 19 Official GA JDK 19 / Java 19 has been officially released. The new release contains a total of 7 new JEPs. 405: Record Patterns (Preview) 422: Linux/RISC-V Port 424: Foreign Function & Memory API (Preview) 425: Virtual Threads (Preview) 426: Vector API (Fourth Incubator) 427: Pattern Matching for switch (Third Preview) 428: Structured Concurrency (Incubator) 405: Record Patterns goes to preview stage Record Patterns deconstructs the values of record, and Record patterns and Type patterns enable powerful, declarative, composable forms of data navigation and processing through nesting.

Java 19 officially released, improve multi-threaded, concurrent programming difficulties

Java 19 was officially released a few minutes ago, a non-LTS (long term support) release with seven features including structured concurrency, record mode, a preview of external functions and memory APIs, and support for the open source Linux/RISC-V instruction set architecture (ISA). New Features JEP 405 Record Patterns (preview) JEP 422 Linux/RISC-V Port JEP 424 Foreign Function & Memory API (preview) JEP 425 Virtual Threads (Preview) JEP 426 Vector API (4th incubation)

Microsoft is fully embracing Java!

Although Microsoft has been using the Java language in many of its products, a recent announcement on its website, “Microsoft is committed to the success of Java developers”, has officially sounded the call for Microsoft to fully embrace Java. NET, TypeScript, Visual BASIC, JScript and so on, why did Microsoft go to the trouble of going deeper into Java? Microsoft’s Latest Moves for Java In this announcement, Julia Liuson, President of Microsoft Developer Division, said, “As a company, we are committed to making Java developers as efficient and productive as possible.