In some cases, we don't want to calculate the expression for logging eagerly cause the performance reason. Then, we would write the code like the following:
Before JDK8, there is no way to encapsulate the above code, because the expression is always calculated before passed as an argument. So, many "if"s appear in the code and smell badly.
Now, the lambda expression is supported by JDK8, the above could be simplified like following:
With the default method definition in the org.slf4j.Logger: