Implement distinct-by.
Generate distinct methods.