commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Steitz <phil.ste...@gmail.com>
Subject Re: [math] Add Pair factory method, toString(), Comparator
Date Wed, 16 Oct 2013 00:13:43 GMT
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


Mime
View raw message