Category: java
In Java, we can use AtomicInteger to declare a integer that is thread-safe. We can wrap an array of AtomicInteger into a Thread-safe class. The following is a Java …
We can use the following Java Wrapper for Lock so that we can Try-With-Resources to Auto Close the Lock: public final class ALock implements AutoCloseable { private final Lock …
In Java, we can use the String’s extension method startsWith to check if it starts with a prefix. We can even specify the start position for the string matching …
In Java, we can use the handy String’s method Split to split a string by the given delimiter into array of strings. Have you wondered how it is implemented? …
Letting users picking password in console is a commonly wanted feature. We let the users enter a password string, and check if it is a valid password e.g. minimal …