commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <scolebou...@joda.org>
Subject Re: [lang] Pair names still not right or consistent
Date Wed, 04 May 2011 17:04:05 GMT
On 4 May 2011 17:58, Gary Gregory <garydgregory@gmail.com> wrote:
> I think we still have naming problems with the Pair class reflected in this
> Javadoc fragment:
>
>  * @param <L> the first element type
>  * @param <R> the second element type
>
> Either we call them L left and R right, or we call them F first and S
> second, but mixing both is not good IMO.
>
> My preference is for K key and V value.

Key and value implies a relationship between the two parts of the pair
(the key somehow describes the value), which we cannot do
(implementing Map.Entry is for convenience, not for any other reason).
Either first/second or left/right are valid choices. At OpenGamma we
use first/second but are able to change to left/right if this class is
released.

> I still do not like Pair as a name because a pair is: two identical,
> similar, or corresponding things that are matched for use together: a pair
> of gloves; a pair of earrings.
> (http://dictionary.reference.com/browse/pair)
>
> We clearly break this common sense definition.

I understand that from an English language POV, but Java devs all over
know this as a pair. No other name will do I'm afraid.

Stephen

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


Mime
View raw message