Add equals/hashCode to APIs, and deprecate groupBy.

equals/hashCode are useful for debugging/verifying/testing,
and the groupBy implementation is naive. It'll be replaced
by a groupBy implementation in Analysis that will handle
external/internal dep transitions correction.

Feel free to pull this one instead of #904 or #901.