Install Java on MacOS cmd

Some useful @FunctionalInterface and when to use them

Functional Interface Function When to use java.util.function.Predicate<T> boolean test(T t); Boolean expression java.util.function.Consumer<T> void accept(T t); Just process T, return nothing java.util.function.Function<T, R> R apply(T t); Transform, compute from type T to type R java.lang.Comparable<T> int compareTo(T o); Compare one T object to another java.lang.Runnable void run(); Accept no params and return nothing java.util.concurrent.Callable<V> V…

Class ForkJoinTask

public abstract class ForkJoinTask<V> extends Object implements Future<V>, Serializable Abstract base class for tasks that run within a ForkJoinPool. A ForkJoinTask is a thread-like entity that is much lighter weight than a normal thread. Huge numbers of tasks and subtasks may be hosted by a small number of actual threads in a ForkJoinPool, at the price of some…

java bitwise operators

Bitwise Operators

Some simple tricks of shifting binary 1 and 0 around and using and (&), or (|) operators could help a lot with eliminating the use of arrays and data structure when implementing a checking algorithm. Operators Precedence postfix expr++ expr– unary ++expr –expr +expr -expr ~ ! multiplicative * / % additive + – shift << >> >>> relational <…