java 8
genericize some common methods