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.

CORE API / NOTES</>↗
Core API26 Jan 2024

How do I check if a character is a whitespace in Java?

Whitespace characters in Java (or programming in general) aren’t just the space ' ' character. It also includes other characters that create some form of space or break in the text. The most common ones include: space ' ' tab '\t' newline '\n' carriage return '\r' form feed '\f'. All these characters fall into the […]

Wayan · 3 min read
JAVA 8 / NOTES</>↗
Java 826 Jan 2024

How to remove map’s entry set elements in certain condition?

In Java, you can use the removeIf() method to remove elements from a Set-based in a certain condition. Here’s how you can do it: First, get the entry set from the map. The entry set is a Set<Map.Entry<K,V>>. Then, call removeIf() on this set. The removeIf() method takes a predicate, which is a condition that […]

Wayan · 2 min read
JAVA 8 / NOTES</>↗
Java 825 Jan 2024

How do I merge the entries of two separate map objects?

You can use putAll() method provided by the Map interface to merge entries of two separate Map objects. The putAll() method copies all the mappings from the specified map to the current map. Pre-existing mappings in the current map are replaced by the mappings from the specified map. Here is a Java code example: package […]

Wayan · 3 min read
JAVA 8 / NOTES</>↗
Java 825 Jan 2024

How do I use replace() and replaceAll() methods of Map?

In Java, the Map interface provides the methods replace() and replaceAll(), which are used to replace existing entries in the map. Replace: replace(K key, V value) is a method that replaces the entry for the specified key only if it is currently mapped to some value. It returns the old value associated with the specified […]

Wayan · 3 min read
JAVA 8 / NOTES</>↗
Java 825 Jan 2024

How do I remove a map entry for the specified key-value?

Beginning from Java 8, the Map interface includes the remove(Object key, Object value) method, which removes the entry for the specified key only if it is currently mapped to the specified value. Here is a Java 8 way of accomplishing this: package org.kodejava.util; import java.util.HashMap; import java.util.Map; public class MapRemoveKeyValueExample { public static void main(String[] […]

Wayan · 2 min read
JAVA 8 / NOTES</>↗
Java 825 Jan 2024

How do I use the compute operations of the map object in Java?

The compute(), computeIfAbsent(), and computeIfPresent() methods introduced in Java 8 provide powerful functionality to modify an existing map in a thread-safe manner. Here’s an example of how you might use each: compute(): Performs the given mapping function to the entry for the specified key. The function is applied even if key is not present or […]

Wayan · 4 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.