Java Consumer refactored