Author: Editorial Team
-
Compact Number Formatting in Java
1. Introduction In US locale, you may have seen 1000 written as “1k”, 1000000 as “1M”. Here, “1K” and “1M” are shorter or compact forms. A compact number formatting refers to the representation of a number in a shorter form, based on the patterns provided for a given locale. CompactNumberFormat is a concrete subclass of…
-
Java Flight Recorder
1. Introduction Java Flight Recorder (JFR) is a tool for collecting diagnostic and profiling data about a running Java application. It is embedded within the Java Virtual Machine (JVM) and introduces minimal performance overhead, making it suitable for use in highly demanding production environments. JFR gathers information about both the JVM and the Java application…
-
Java Predicate.not() method
1. Introduction In this short tutorial, we’ll discuss the not() method of Predicate Interface. This method was added in Java 11. 2. Syntax static<T> Predicate<T> not(Predicate<? super T> target) : This method returns a predicate that is the negation of the supplied predicate. This is accomplished by returning result of the calling target.negate(). 3. Example…
-
Java 11 Files.readString() and Files.writeString() methods
1. Introduction In this tutorial, we’ll discuss two methods added in Java 11 in Files class, readString() and writeString(). 2. Syntax static String readString(Path path) Reads all content from a file into a string, decoding from bytes to characters using the UTF-8 charset. static String readString(Path path, Charset cs) Reads all characters from a file…
-
Java 11 Single-File Source-Code Programs
1. Introduction Java 11 introduced a new feature of launching single-file source-code programs. A single-file program is one where the program fits in a single source file. Before Java 11, to run even a single line program we had to first compile the code and then run the program. For example, to run a HelloWorld.java…
-
The Z Garbage Collector
1. Introduction In this tutorial, we’ll discuss the Z garbage collector(ZGC) in Java. ZGC is a scalable low-latency garbage collector. In Java 11, ZGC was introduced as an experimental feature. In Java 15, this was included as a product feature in Java after receiving positive feedback and fixing of bugs. ZGC was integrated into JDK…
-
Redux Toolkit example
1. Introduction In this tutorial we’ll rewrite our Redux example we created earlier with Redux Toolkit. 2. Configure Store with Redux Toolkit The configureStore API from Redux Toolkit creates a Redux store that holds the complete state tree of your app, and also automatically configure the Redux DevTools extension so that you can inspect the…
-
React useMemo hook
1. Introduction In this tutorial, we’ll discuss the useMemo hook which plays important role in performance optimization of the application. The React useMemo hook lets you cache the result of a calculation between re-renders. You call useMemo at the top level of your component to cache a calculation value between re-rendering of the component. 2.…
-
Introduction in Redux Thunk
1. Introduction Thunks are a standard approach for writing async logic in Redux apps, and are commonly used for data fetching. The word “thunk” is a programming term that means “a piece of code that does some delayed work”. This means we can write a function which has some logic that executes later. According to…
-
Code Structure in Redux
1. Introduction In this short tutorial, we’ll discuss the two approaches to structure code files in your Redux project. 2. First approach In the first approach, a folder is created for each slice in the store. For example, if two types of state data is maintained in the store tasks and students, then there will…
