Friday, December 26, 2025 2 posts

✍️ ningnong
Initialize Java Object In Java, objects are instances of classes, and there are multiple ways to initialize them. Below are some common methods to create and initialize objects in J...
Read more β†’
✍️ ningnong
import java.util.Map; import java.util.HashMap; /** * Main class to test the longest substring without repeating characters. */ public class Main {    &n...
Read more β†’

Thursday, December 25, 2025 2 posts

✍️ ningnong
​The Map.get() method in Java retrieves the value associated with a specific key in a map. If the key does not exist, it returns null . The return type of get() depends on the type of v...
Read more β†’
✍️ ningnong
The getOrDefault method in Java's Map interface provides a convenient way to retrieve a value for a given key. If the key is not present in the map, it returns a specified default value instea...
Read more β†’

Thursday, December 18, 2025 1 post

✍️ ningnong
Here’s a complete, runnable Java program that benchmarks ArrayList vs LinkedList for add , get , and remove operations. It uses System.nanoTime() for timing and handles edge cases l...
Read more β†’