Java 8 Optionals for Null Objects

Reading Time: 2 minutesIn my previous post, I mentioned about refactoring techniques including testing interface for null checks. I have recognized that there is an alternative for it while reading Java 8 in Action: Lambdas, streams, and functional-style programming. Optional Class If there is an object that might contain a null value, we can use Optional to wrap the

Read More

How to deal with nested conditionals (Part 2)

Reading Time: 2 minutesIn my previous post, I mentioned about Decomposing Conditional and Consolidate Conditional Expression for nested conditionals. The problem was not only the nested conditions but also duplicated code fragments and lots of null object controls.  In this post, we will cover Consolidate Duplicate Conditional Fragments and Testing Interface to tackle the above mentioned problems. Consolidate Duplicate Conditional Fragments

Read More