java 8 refactorings - use optional class instead of null check