Re: [Lang] Pair toString

2011-04-28 Thread Stephen Colebourne
On 20/04/2011, Matt Benson wrote: > On Wed, Apr 20, 2011 at 1:10 AM, Henri Yandell wrote: >> Is Pair now good (for a value of consensually agreed good)? > > Good enough, although Stephen noted in ImmutablePair's javadoc that > being non-final, a subclass could add > undesirable/counter-to-expecta

Re: [Lang] Pair toString

2011-04-21 Thread Oliver Heger
Am 21.04.2011 08:24, schrieb Jörg Schaible: Hi Hen, Henri Yandell wrote: On Wed, Apr 20, 2011 at 3:25 PM, Gary Gregory wrote: [snip] PairFormat class needed rather than relying on toString functionality :) Could we implement Formattable? +1 Something new learned today :) - Jörg Yes

Re: [Lang] Pair toString

2011-04-20 Thread Jörg Schaible
Hi Hen, Henri Yandell wrote: > On Wed, Apr 20, 2011 at 3:25 PM, Gary Gregory > wrote: [snip] > > PairFormat class needed rather than relying on toString functionality :) > > Could we implement Formattable? +1 Something new learned today :) - Jörg

Re: [Lang] Pair toString

2011-04-20 Thread Henri Yandell
On Wed, Apr 20, 2011 at 3:25 PM, Gary Gregory wrote: > On Wed, Apr 20, 2011 at 5:07 PM, Matt Benson wrote: > >> On Wed, Apr 20, 2011 at 3:46 PM, Gary Gregory >> wrote: >> > On Wed, Apr 20, 2011 at 4:36 PM, Jörg Schaible > >wrote: >> > >> >> Gary Gregory wrote: >> >> >> >> > On Wed, Apr 20, 2011

Re: [Lang] Pair toString

2011-04-20 Thread Gary Gregory
On Wed, Apr 20, 2011 at 5:07 PM, Matt Benson wrote: > On Wed, Apr 20, 2011 at 3:46 PM, Gary Gregory > wrote: > > On Wed, Apr 20, 2011 at 4:36 PM, Jörg Schaible >wrote: > > > >> Gary Gregory wrote: > >> > >> > On Wed, Apr 20, 2011 at 1:24 PM, Matt Benson > >> wrote: > >> > > >> >> On Wed, Apr 2

Re: [Lang] Pair toString

2011-04-20 Thread Matt Benson
On Wed, Apr 20, 2011 at 4:07 PM, Matt Benson wrote: > On Wed, Apr 20, 2011 at 3:46 PM, Gary Gregory wrote: >> On Wed, Apr 20, 2011 at 4:36 PM, Jörg Schaible wrote: >> >>> Gary Gregory wrote: >>> >>> > On Wed, Apr 20, 2011 at 1:24 PM, Matt Benson >>> wrote: >>> > >>> >> On Wed, Apr 20, 2011 at 1:

Re: [Lang] Pair toString

2011-04-20 Thread Matt Benson
On Wed, Apr 20, 2011 at 3:46 PM, Gary Gregory wrote: > On Wed, Apr 20, 2011 at 4:36 PM, Jörg Schaible wrote: > >> Gary Gregory wrote: >> >> > On Wed, Apr 20, 2011 at 1:24 PM, Matt Benson >> wrote: >> > >> >> On Wed, Apr 20, 2011 at 1:10 AM, Henri Yandell >> >> wrote: >> >> > Is Pair now good (fo

Re: [Lang] Pair toString

2011-04-20 Thread Gary Gregory
On Wed, Apr 20, 2011 at 4:36 PM, Jörg Schaible wrote: > Gary Gregory wrote: > > > On Wed, Apr 20, 2011 at 1:24 PM, Matt Benson > wrote: > > > >> On Wed, Apr 20, 2011 at 1:10 AM, Henri Yandell > >> wrote: > >> > Is Pair now good (for a value of consensually agreed good)? > >> > >> Good enough, al

Re: [Lang] Pair toString

2011-04-20 Thread Jörg Schaible
Gary Gregory wrote: > On Wed, Apr 20, 2011 at 1:24 PM, Matt Benson wrote: > >> On Wed, Apr 20, 2011 at 1:10 AM, Henri Yandell >> wrote: >> > Is Pair now good (for a value of consensually agreed good)? >> >> Good enough, although Stephen noted in ImmutablePair's javadoc that >> being non-final,

Re: [Lang] Pair toString

2011-04-20 Thread Gary Gregory
On Wed, Apr 20, 2011 at 1:24 PM, Matt Benson wrote: > On Wed, Apr 20, 2011 at 1:10 AM, Henri Yandell wrote: > > Is Pair now good (for a value of consensually agreed good)? > > Good enough, although Stephen noted in ImmutablePair's javadoc that > being non-final, a subclass could add > undesirabl

Re: [Lang] Pair toString

2011-04-20 Thread sebb
On 20 April 2011 18:24, Matt Benson wrote: > On Wed, Apr 20, 2011 at 1:10 AM, Henri Yandell wrote: >> Is Pair now good (for a value of consensually agreed good)? > > Good enough, although Stephen noted in ImmutablePair's javadoc that > being non-final, a subclass could add > undesirable/counter-t

Re: [Lang] Pair toString

2011-04-20 Thread Matt Benson
On Wed, Apr 20, 2011 at 1:10 AM, Henri Yandell wrote: > Is Pair now good (for a value of consensually agreed good)? Good enough, although Stephen noted in ImmutablePair's javadoc that being non-final, a subclass could add undesirable/counter-to-expectation behavior. I can't see any reason why we

Re: [Lang] Pair toString

2011-04-19 Thread Henri Yandell
Is Pair now good (for a value of consensually agreed good)? On Mon, Apr 11, 2011 at 7:00 AM, Gary Gregory 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. > > Subcla

Re: [Lang] Pair toString

2011-04-11 Thread Gary Gregory
On Mon, Apr 11, 2011 at 6:36 PM, Gary Gregory wrote: > On Mon, Apr 11, 2011 at 4:25 PM, Matt Benson wrote: > >> On Mon, Apr 11, 2011 at 1:17 PM, Gary Gregory >> wrote: >> > On Mon, Apr 11, 2011 at 2:14 PM, Gary Gregory > >wrote: >> > >> >> On Mon, Apr 11, 2011 at 1:52 PM, Stephen Colebourne < >>

Re: [Lang] Pair toString

2011-04-11 Thread Gary Gregory
On Mon, Apr 11, 2011 at 4:25 PM, Matt Benson wrote: > On Mon, Apr 11, 2011 at 1:17 PM, Gary Gregory > wrote: > > On Mon, Apr 11, 2011 at 2:14 PM, Gary Gregory >wrote: > > > >> On Mon, Apr 11, 2011 at 1:52 PM, Stephen Colebourne < > scolebou...@joda.org>wrote: > >> > >>> I fixed the Map.Entry eq

Re: [Lang] Pair toString

2011-04-11 Thread Matt Benson
On Mon, Apr 11, 2011 at 1:17 PM, Gary Gregory wrote: > On Mon, Apr 11, 2011 at 2:14 PM, Gary Gregory wrote: > >> On Mon, Apr 11, 2011 at 1:52 PM, Stephen Colebourne >> wrote: >> >>> I fixed the Map.Entry equals/hashCode compliance. >>> >>> I shortened the toString form to omit the class name, as

Re: [Lang] Pair toString

2011-04-11 Thread Gary Gregory
On Mon, Apr 11, 2011 at 2:14 PM, Gary Gregory wrote: > On Mon, Apr 11, 2011 at 1:52 PM, Stephen Colebourne > 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 bra

Re: [Lang] Pair toString

2011-04-11 Thread Gary Gregory
On Mon, Apr 11, 2011 at 1:52 PM, Stephen Colebourne 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 requiri

Re: [Lang] Pair toString

2011-04-11 Thread Gary Gregory
On Mon, Apr 11, 2011 at 1:52 PM, Stephen Colebourne 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 requiri

Re: [Lang] Pair toString

2011-04-11 Thread Stephen Colebourne
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 sm

Re: [Lang] Pair toString

2011-04-11 Thread Adrian Crum
There is no aversion to customizing toString(). You said your choices were subclassing, delegating, or convince the Commons community to change the Pair class. If the Pair class isn't changed, then you're left with the first two options. Personally, I prefer using the "has a" pattern over the "

Re: [Lang] Pair toString

2011-04-11 Thread Gary Gregory
On Mon, Apr 11, 2011 at 12:19 PM, Adrian Crum < adrian.c...@sandglass-software.com> wrote: > Delegating is trivial in Eclipse - it will write the code for you. As for > delegating versus "rolling your own" - delegating leverages the code > maturity and unit tests of the delegate. > Roger that. Sp

Re: [Lang] Pair toString

2011-04-11 Thread Adrian Crum
Delegating is trivial in Eclipse - it will write the code for you. As for delegating versus "rolling your own" - delegating leverages the code maturity and unit tests of the delegate. -Adrian On 4/11/2011 9:16 AM, Gary Gregory wrote: On Mon, Apr 11, 2011 at 10:12 AM, Matt Benson wrote: On

Re: [Lang] Pair toString

2011-04-11 Thread Gary Gregory
On Mon, Apr 11, 2011 at 10:12 AM, Matt Benson wrote: > On Mon, Apr 11, 2011 at 9:00 AM, Gary Gregory > 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

Re: [Lang] Pair toString

2011-04-11 Thread Adrian Crum
Why not make your custom Pair class a delegator? -Adrian On 4/11/2011 7:00 AM, Gary Gregory 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 M

Re: [Lang] Pair toString

2011-04-11 Thread Gary Gregory
On Mon, Apr 11, 2011 at 10:14 AM, Matt Benson wrote: > On Mon, Apr 11, 2011 at 9:06 AM, Gary Gregory > wrote: > > Also: > > > > Why go through this complicated code path: > > > > StringBuilder builder = new > StringBuilder(ClassUtils.getShortClassName(this, > > null)); > > > > instead of the sim

Re: [Lang] Pair toString

2011-04-11 Thread Matt Benson
On Mon, Apr 11, 2011 at 9:06 AM, Gary Gregory wrote: > Also: > > Why go through this complicated code path: > > StringBuilder builder = new StringBuilder(ClassUtils.getShortClassName(this, > null)); > > instead of the simpler: > > StringBuilder builder = new StringBuilder(this.getClass().getSimple

Re: [Lang] Pair toString

2011-04-11 Thread Matt Benson
On Mon, Apr 11, 2011 at 9:00 AM, Gary Gregory 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 smel

Re: [Lang] Pair toString

2011-04-11 Thread Gary Gregory
Also: Why go through this complicated code path: StringBuilder builder = new StringBuilder(ClassUtils.getShortClassName(this, null)); instead of the simpler: StringBuilder builder = new StringBuilder(this.getClass().getSimpleName()); ? Thank you, Gary On Mon, Apr 11, 2011 at 10:00 AM, Gary G

[Lang] Pair toString

2011-04-11 Thread Gary Gregory
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