KOTLIN / NOTES</>↗Kotlin02 Jun 2025
Destructuring declarations in Kotlin simplify the process of unpacking values from objects, data classes, maps, arrays, or collections into individual variables. This is particularly useful when working with complex objects or collections. Below is an explanation of how to use destructuring declarations in different scenarios. 1. Data Classes Destructuring declarations work seamlessly with data classes. […]
KOTLIN / NOTES</>↗Kotlin02 Jun 2025
In Kotlin, scope functions such as let, also, and run can be used effectively for handling null safety. These functions allow you to operate on nullable objects and execute a block of code only if the object is not null. Here’s how these scope functions can be applied for null safety: 1. let The let […]
KOTLIN / NOTES</>↗Kotlin01 Jun 2025
In Kotlin, the !! operator is called the not-null assertion operator. It is used to tell the compiler that a null value will never be encountered for a given variable. If Kotlin encounters a null during runtime while using !!, it will throw a NullPointerException (NPE). While using !! can be convenient in some cases, […]
KOTLIN / NOTES</>↗Kotlin01 Jun 2025
In Kotlin, smart casts are a feature that allows the compiler to automatically cast an object to a target type within a certain scope if it determines that the cast is safe. Smart casts are most commonly used in control flow statements, such as if, when, and loops. Here’s how you can use smart casts […]
IO / NOTES</>↗IO01 Jun 2025
Java 17 introduced several significant enhancements in the java.nio.file package, focusing on improving file system operations, security, and performance. Below is an explanation of the new APIs and available enhancements, with examples demonstrating how to use them. Key API Enhancements in java.nio.file for Java 17 1. Files.mismatch() The method Files.mismatch(Path, Path) was added to efficiently […]
BASIC / NOTES</>↗Basic31 May 2025
To compile and run Java 17 code using the command line, follow these steps: 1. Install Java 17 Ensure that Java 17 is installed on your system. Run the following command to check the installed Java version: java -version If Java 17 is not installed, download and install it from the official Oracle website or […]