Refactoring to a more functional idiom using guava