Add equals/hashCode to APIs, and remove groupBy.

equals/hashCode are useful for debugging/verifying/testing,
and the groupBy implementation was naive. It'll be replaced
by a groupBy implementation in Analysis that will handle
external/internal dep transitions correction.