Hey, On Wed, May 4, 2011 at 9:58 AM, Gary Gregory <garydgreg...@gmail.com> wrote: > Hi All: > > 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.
First and second is better, a Pair is an instance of a 2-tuple, which is an ordered list of elements. Left and right is no good IMO. > My preference is for K key and V value. > > 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. This is not the common definition in math and computer science. > Tuple is better, Association is better (if wordier.) > > Why is Pair a good name? A Pair is a 2-tuple, not a tuple. OrderedPair or TwoTuple might be more "accurate" names but I think Pair is very descriptive, short and sweet. > Writing Pair.of(lastName, address) reads ugly and wrong to me. It feels like > I am writing a bug or using the API incorrectly. How does that sound wrong? I think it reads rather nicely. > The association, correspondence, tuple, whatever you call it, of these two > values is just not a pair of anything. Anything but java.lang.Object... but > that's not even true since null is not an Object. > > -- > Thank you, > Gary Regards, James --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org