I was looking up alternatives to using instance of in java 8, since I wanted to call different classes based on the type of the input object. I came across a solution by Jhon Ve