commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephen Colebourne <>
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 <> 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

> 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.
> (
> 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.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message