|
From: Oliver H. <Ol...@ou...> - 2005-07-22 02:21:39
|
Actually I see this is only the case for ComparableComparator (I've got to many versions of the code open at the moment) the NullSafeComparator and BooleanComparator singletons are still there.=20 My question still stands through.=20 Oliver > -----Original Message----- > From: spr...@li...=20 > [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 >=20 > I've just started upgrading Spring Rich to the latest spring=20 > code base and noticed that all of the Comparator singletons=20 > (which Spring Rich uses a lot) in the o.s.util.comparator=20 > package have been removed.=20 >=20 > These classes are IMHO perfect examples of where you should=20 > be using a singleton. Given that every instance will exhibit=20 > exactly the same behaviour, why would you ever want to have=20 > more that one instance of a class like ComparableComparator?=20 > 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=20 > about the rational behind the removal?=20 >=20 > Thanks, >=20 > Oliver >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration=20 > Strategies from IBM. Find simple to follow Roadmaps,=20 > straightforward articles, informative Webcasts and more! Get=20 > everything you need to get up to speed, fast.=20 > 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 >=20 |
|
From: Oliver H. <Ol...@ou...> - 2005-07-22 08:48:51
|
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...=20 > [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=20 > NULLS_HIGH, each using a ComparableComparator underneath. I=20 > guess you could simply use those singletons rather than one=20 > 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=20 > (I've got to many versions of the code open at the moment)=20 > the NullSafeComparator and BooleanComparator singletons are=20 > still there.=20 >=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=20 > spring code base=20 > > and noticed that all of the Comparator singletons (which=20 > Spring Rich=20 > > uses a lot) in the o.s.util.comparator package have been removed. > >=20 > > These classes are IMHO perfect examples of where you should=20 > be using a=20 > > singleton. Given that every instance will exhibit exactly the same=20 > > behaviour, why would you ever want to have more that one=20 > instance of a=20 > > class like ComparableComparator? > > Also how much cleaner is this: > >=20 > > ComparableComparator.nullSafeInstance().compare(argument1,=20 > 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=20 > about the=20 > > rational behind the removal? > >=20 > > Thanks, > >=20 > > Oliver > >=20 > >=20 > >=20 > > ------------------------------------------------------- > > SF.Net email is sponsored by: Discover Easy Linux Migration=20 > Strategies=20 > > 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=20 > Strategies from IBM. Find simple to follow Roadmaps,=20 > straightforward articles, informative Webcasts and more! Get=20 > 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 >=20 >=20 >=20 >=20 > ------------------------------------------------------- > SF.Net email is sponsored by: Discover Easy Linux Migration=20 > Strategies from IBM. Find simple to follow Roadmaps,=20 > straightforward articles, informative Webcasts and more! Get=20 > everything you need to get up to speed, fast.=20 > 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 >=20 |
|
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 |
|
From: Oliver H. <Ol...@ou...> - 2005-07-22 09:22:13
|
> You would hardly ever use ComparableComparator directly for=20 > sorting or the like. You would rather simply rely on=20 > "natural" sort order, i.e. Comparable directly. E.g.=20 > "Collections.sort(List, Comparator)" vs "Collections.sort(List)". True. But most of the code (in SpringRich) that I'm dealing with does not take the "natural" sort order into consideration i.e. you must always supply a Comparator. So for me I keep looking to ComparableComparator for this "natural" case and naturally I also want everything to be null safe but this is a secondary consideration. Regardless, I'm happy to use the NullSafeComparator singletons.=20 Thanks, Ollie |
|
From: Juergen H. <ju...@in...> - 2005-07-22 08:12:03
|
NullSafeComparator has two such singletons: NULLS_LOW and NULLS_HIGH, = each using a ComparableComparator underneath. I guess you could simply use = those singletons rather than one on ComparableComparator itself. Juergen =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? Actually I see this is only the case for ComparableComparator (I've got = to many versions of the code open at the moment) the NullSafeComparator and BooleanComparator singletons are still there.=20 My question still stands through.=20 Oliver > -----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=20 > 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=20 > 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... > 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 |