On Wed, Apr 20, 2011 at 4:36 PM, Jörg Schaible <joerg.schai...@gmx.de>wrote:

> Gary Gregory wrote:
>
> > On Wed, Apr 20, 2011 at 1:24 PM, Matt Benson <gudnabr...@gmail.com>
> wrote:
> >
> >> On Wed, Apr 20, 2011 at 1:10 AM, Henri Yandell <flame...@gmail.com>
> >> 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 shouldn't make this class final, particularly as the option
> >> always exists to lift that restriction should someone later provide a
> >> justification for doing so.  Does anyone object to this?
> >>
> >
> > Please do not make the class final.
> >
> > The first thing I want to do is dump my custom pair class and plug this
> > one in. But, in order to do so, I need to override toString().
> >
> > Which gives me another custom class... so why do I want to do this? Hm...
> > good question. Until I play with it some more, I am not sure which way to
> > go for my use case. Just don't lock me out ;)
>
> Couldn't you use in that case Pair<T,U> directly?
>

If I use a pair directly, then the call site has to know about the toString
argument, which I want to hide in a subclass. I could have a MyPairUtils
that hides it instead I suppose. Not the prettiest but it avoids subclassing
I suppose.

Still, don't lock me out from trying :)

Gary


>
> - Jörg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


-- 
Thank you,
Gary

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

Reply via email to