Tag: 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? …
The following FileUtils.readFile takes a file path, and a second paramter charset – then it will read the content of the file and return as a string. This is …