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

Sylvain Lebresne commented on CASSANDRA-14260:
----------------------------------------------

For what it's worth, I would prefer moving out of using {{Pair}} all over the 
place and use specific classes instead. Just to illustrate, I'm talking of 
adding a {{SizeEstimate}} (or other name) with 2 fields {{partitionCount}} and 
{{meanSize}} for instance instead of the pair used for size estimates. I reckon 
this technically add a bit more lines of code over reusing a {{Pair}} class, 
but I feel it largely pay for itself in term of code clarity and 
error-proneness. If you get a {{LongLongPair}} from a method, you constantly 
have to double check which field is which, which I personally find annoying and 
is easy to mess up.

Anyway, that remark obviously apply to all usage of {{Pair}} while I understand 
you intent here is just to avoid boxing, but in the off-change that there is 
agreement on the remarks above, I figured this may be a good occasion to start 
cleaning this up as well rather than add more "pair" classes.

> Refactor pair to avoid boxing longs/ints
> ----------------------------------------
>
>                 Key: CASSANDRA-14260
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14260
>             Project: Cassandra
>          Issue Type: Improvement
>            Reporter: Jeff Jirsa
>            Assignee: Jeff Jirsa
>            Priority: Minor
>             Fix For: 4.x
>
>
> We uses Pair<X,Y> all over the place, and in many cases either/both of X and 
> Y are primitives (ints, longs), and we end up boxing them into Integers and 
> Longs. We should have specialized versions that take primitives. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to