SupportWriter space ↗
REFERENCE LIBRARY

References from other publishers

Republished articles with source attribution. This collection is separate from Diary Coding’s original guides and does not display ads.

Read original guides → · Editorial policy

FOR YOUR CURIOSITY

Latest notes.

KOTLIN / NOTES</>↗
Kotlin08 May 2025

How do I use the when expression as a switch alternative in Kotlin?

In Kotlin, the when expression can be used as an alternative to the traditional switch statement found in languages like Java. The when expression is versatile, concise, and supports a wide range of matching conditions. Here’s how you can use it: Examples of Using the when Expression Using when as a simple switch: fun getResponse(code: […]

Wayan · 3 min read
CONCURRENCY / NOTES</>↗
Concurrency08 May 2025

How do I throttle concurrent threads using ThreadPoolExecutor settings?

To throttle concurrent threads using ThreadPoolExecutor settings in Java, you can configure its key parameters: core pool size, maximum pool size, and queue capacity. These settings control how ThreadPoolExecutor manages the number of concurrently running threads and queued tasks. Explanation of Key ThreadPoolExecutor Settings: Core Pool Size: This defines the number of threads that are […]

Wayan · 3 min read
CONCURRENCY / NOTES</>↗
Concurrency07 May 2025

How do I process tasks as they complete using CompletionService?

To process tasks as they complete using a CompletionService in Java, you can take advantage of the ExecutorCompletionService. This class provides a mechanism to submit tasks for execution and retrieve their results in the order of completion, rather than the order of submission. Key Steps for Using CompletionService: Create an ExecutorService: This handles the thread […]

Wayan · 3 min read
CONCURRENCY / NOTES</>↗
Concurrency07 May 2025

How do I cancel long-running tasks in ExecutorService?

To cancel long-running tasks in an ExecutorService, you can use the Future object returned when you submit a task and invoke its cancel method. Below are the steps and some important considerations for canceling tasks: 1. Submit Tasks to the ExecutorService When you submit a task to an ExecutorService, it returns a Future object that […]

Wayan · 3 min read
KOTLIN / NOTES</>↗
Kotlin06 May 2025

How do I use default and named arguments in Kotlin functions?

In Kotlin, you can use default arguments and named arguments to simplify function calls and make your code more readable and flexible. Here’s how each of them works: Default Arguments Default arguments allow you to set a default value for a function parameter. If you don’t pass a value for that parameter when calling the […]

Wayan · 3 min read
KOTLIN / NOTES</>↗
Kotlin06 May 2025

How do I define and call functions in Kotlin?

In Kotlin, defining and calling functions is straightforward and follows a clear syntax. Here’s how you can define and use functions: Defining a Function The fun keyword is used to define a function in Kotlin. Basic Syntax: fun functionName(parameters: ParameterType): ReturnType { // Function body return someValue // Optional if the return type is Unit […]

Wayan · 3 min read
✳

Knowledge grows when shared.

Stay curious. There is always something new to learn.

Explore notes ↗
Putu Adi Guna Permana
ABOUT THE AUTHOR

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Writer and founder of Diary Coding — sharing notes, tutorials, and experiences about programming for anyone who wants to keep learning.