commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [Lang] Pair toString
Date Mon, 11 Apr 2011 18:08:00 GMT
On Mon, Apr 11, 2011 at 1:52 PM, Stephen Colebourne <scolebourne@joda.org>wrote:

> I fixed the Map.Entry equals/hashCode compliance.
>
> I shortened the toString form to omit the class name, as it is
> superfluous -> (A,B)
>
> Out library uses square brackets, but I can live with round.
>
> I don't believe that requiring every pair to carry around a format
> string is viable. These must be small objects. I could live with a
> toString(format) variation if that would help.
>

I can see that carrying a format object is painful. Using a toString(format)
is a compromise I can live with. I've added in SVN with a matching test.

Gary

>
> I also believe that getLeftElement()/getRightElement() are too long.
> They should be getLeft()/getRight().
>
> I'd also prefer to make the ImmuatblePair final.
>
> Stephen
>
>
> On 11 April 2011 15:00, Gary Gregory <garydgregory@gmail.com> wrote:
> > Hi All:
> >
> > I added a test to verify the default Pair toString behavior.
> >
> > For me to replace our custom Pair class at work, I need to customize the
> to
> > String behavior.
> >
> > Subclassing ImmutablePair and MutablePair to override toString smells
> nasty.
> >
> > What about adding a formatString ivar which will be used with the
> > String.format API?
> >
> > --
> > Thank you,
> > Gary
> >
> > http://garygregory.wordpress.com/
> > http://garygregory.com/
> > http://people.apache.org/~ggregory/
> > http://twitter.com/GaryGregory
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
Thank you,
Gary

http://garygregory.wordpress.com/
http://garygregory.com/
http://people.apache.org/~ggregory/
http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message