[ 
https://issues.apache.org/jira/browse/HTRACE-392?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15606201#comment-15606201
 ] 

Mike Drob commented on HTRACE-392:
----------------------------------

So, the reason I was putting everything in a HashMap was because I was building 
a graph of the parent child relationships and using that to test my code that 
expected spans were getting generated. Some of the spans had multiple parents, 
so they would show up multiple times as I was traversing the graph, and I 
needed to dedup.

I ended up using doing the following:
{code}
new TreeSet<Span>((Span s1, Span s2) -> {
  return s1.getSpanId().compareTo(s2.getSpanId));
});
{code}

which suggests that instead of implementing e/hc we could also make Span 
implement Comparable and order by SpanId? Implementing equality based on id 
seems fine though.

> MilliSpan does not implement equals and hashcode
> ------------------------------------------------
>
>                 Key: HTRACE-392
>                 URL: https://issues.apache.org/jira/browse/HTRACE-392
>             Project: HTrace
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 4.2
>            Reporter: Mike Drob
>
> MilliSpan does not implement equal and hashcode, which can make test fixtures 
> unnecessarily brittle when doing comparisons.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to