Java Collections Static Factory Methods

With Java9 we finally get an easy way to construct collections. I think the map is one that I will be using  quite often. Now I can write: Map<String,String> lookupMap = Map.ofEntries( entry(“a”, “A”), entry(“b”, “B”), entry(“c”, “C”)); Instead of: Map<String, String> lookupMap = new HashMap<>(); lookupMap.put(“a”,”A”); lookupMap.put(“b”,”B”); lookupMap.put(“c”,”C”);

Java 8 default methods

Why OK, so interfaces can now provide a default implementation. This makes sense if you want to be able to add new methods to your interface without breaking existing implementations. Oracle uses default methods quiet extensively (see java.util.Collection). Simple example public class SimpleExample { interface Interface1 { default void test() { System.out.println(“– default test”); } default void test2() { System.out.println(“–… Continue reading Java 8 default methods

Spring Boot Health Checks

Spring Boot brings along some cool “production ready” features. Among them are the health checks. They are a great way to give you a quick overview about the system state. Is the database up and running, is my disk running out of space? Getting started Having a Spring Boot application already setup you just have… Continue reading Spring Boot Health Checks