|
From: Juergen H. <ju...@in...> - 2005-07-22 08:58:45
|
Well, depends on whether one consider NullSafeComparator as a plain decorator. Arguably NullSafeComparator is most useful for Comparables. = The primary point of the class is to compare Comparables in a null-safe = fashion. ComparableComparator on the other hand is really just a plain adapter between Comparator and Comparable, without any value-add. It's mainly = useful as internal adapter, not so much for plain direct usage. You would hardly ever use ComparableComparator directly for sorting or = the like. You would rather simply rely on "natural" sort order, i.e. = Comparable directly. E.g. "Collections.sort(List, Comparator)" vs "Collections.sort(List)". Juergen =20 -----Original Message----- From: spr...@li... [mailto:spr...@li...] On Behalf = Of Oliver Hutchison Sent: Friday, July 22, 2005 10:49 AM To: spr...@li... Subject: RE: [Springframework-developer] Comparator singletons MIA? Ahhh.... Don't these really belong in ComparableComparator? Given that they would mostly compare Comparables? To be honest I wouldn't even think to look = in NullSafeComparator for a ComparableComparator. But I can live with it ;-) Thanks, Ollie > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...] > On Behalf Of Juergen Hoeller > Sent: Friday, 22 July 2005 6:12 PM > To: spr...@li... > Subject: Re: [Springframework-developer] Comparator singletons MIA? >=20 > NullSafeComparator has two such singletons: NULLS_LOW and NULLS_HIGH,=20 > each using a ComparableComparator underneath. I guess you could simply = > use those singletons rather than one on ComparableComparator itself. >=20 > Juergen > =20 >=20 > -----Original Message----- > From: spr...@li... > [mailto:spr...@li...] > On Behalf Of Oliver Hutchison > Sent: Friday, July 22, 2005 4:22 AM > To: spr...@li... > Subject: RE: [Springframework-developer] Comparator singletons MIA? >=20 > Actually I see this is only the case for ComparableComparator (I've=20 > got to many versions of the code open at the moment) the=20 > NullSafeComparator and BooleanComparator singletons are still there. >=20 > My question still stands through.=20 >=20 > Oliver >=20 > > -----Original Message----- > > From: spr...@li... > > [mailto:spr...@li...] > > On Behalf Of Oliver Hutchison > > Sent: Friday, 22 July 2005 10:32 AM > > To: spr...@li... > > Subject: [Springframework-developer] Comparator singletons MIA? > >=20 > > Jurgen, > >=20 > > I've just started upgrading Spring Rich to the latest > spring code base > > and noticed that all of the Comparator singletons (which > Spring Rich > > uses a lot) in the o.s.util.comparator package have been removed. > >=20 > > These classes are IMHO perfect examples of where you should > be using a > > singleton. Given that every instance will exhibit exactly the same=20 > > behaviour, why would you ever want to have more that one > instance of a > > class like ComparableComparator? > > Also how much cleaner is this: > >=20 > > ComparableComparator.nullSafeInstance().compare(argument1, > argument2) > >=20 > > to this? > >=20 > > new NullSafeComparator(new ComparableComparator(),=20 > > true).compare(argument1, argument2) > >=20 > > and more performant to boot. > >=20 > > Anyway, obviously I can live without them, but I'm curious > about the > > rational behind the removal? > >=20 > > Thanks, > >=20 > > Oliver > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > SF.Net email is sponsored by: Discover Easy Linux Migration > Strategies > > from IBM. Find simple to follow Roadmaps, straightforward articles,=20 > > informative Webcasts and more! Get everything you need to get up to=20 > > speed, fast. > > http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick > > _______________________________________________ > > Springframework-developer mailing list=20 > > Spr...@li... > >=20 > https://lists.sourceforge.net/lists/listinfo/springframework-developer > >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies = > from IBM. Find simple to follow Roadmaps, straightforward articles,=20 > informative Webcasts and more! Get everything you need to get up to=20 > speed, fast. > http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick > _______________________________________________ > Springframework-developer mailing list=20 > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer >=20 >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration Strategies = > from IBM. Find simple to follow Roadmaps, straightforward articles,=20 > informative Webcasts and more! Get everything you need to get up to=20 > speed, fast. > http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick > _______________________________________________ > Springframework-developer mailing list=20 > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer >=20 ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies = from IBM. Find simple to follow Roadmaps, straightforward articles, = informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id=16492&op=3Dick _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |