instanceof and Visitor pattern replacement for Java 8