You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Sean Owen <sr...@apache.org> on 2013/10/15 23:51:49 UTC

[math] Add Pair factory method, toString(), Comparator

Hello all,

I'd like to propose a few small additions to the Pair class in Common
Math3: a factory method, to avoid redundant generics-related eclarations, a
toString() method, and a basic Comparator.

It's already pretty well summarized, simple as it is, at
https://issues.apache.org/jira/browse/MATH-1041 along with a current patch.

Thanks for your feedback.

Sean

Re: [math] Add Pair factory method, toString(), Comparator

Posted by Phil Steitz <ph...@gmail.com>.
On 10/15/13 2:51 PM, Sean Owen wrote:
> Hello all,
>
> I'd like to propose a few small additions to the Pair class in Common
> Math3: a factory method, to avoid redundant generics-related eclarations, a
> toString() method, and a basic Comparator.
>
> It's already pretty well summarized, simple as it is, at
> https://issues.apache.org/jira/browse/MATH-1041 along with a current patch.
>
> Thanks for your feedback.
>
> Sean
>

Seems useful.  The factory and toString I see as nice additions. 
The Comparator I am not so sure about as it only works for
Comparables.  If we do add it, It should probably have a more
descriptive name like LexicographicPairComparator, since it is
implementing just one way to order pairs.  It might be best also to
make the null behavior configurable - throw, null high, null low.  I
guess low or high is forced if we want it to be consistent with
equals, given the way Pair implements equals, so maybe just an
optional boolean config.  I am OK leaving as is with clear javadoc
(which the patch has, modulo fixing s/of/create in the example).  I
am OK with either of or create as the factory method name.

Thanks for the patch!

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org