java 8 refactorings - use optional class instead of null check & use stream api to filter collections