|
From: Oliver H. <Ol...@ou...> - 2005-07-22 00:32:28
|
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 behaviour, why would you ever want to have more that one instance of a class like ComparableComparator? Also how much cleaner is this: ComparableComparator.nullSafeInstance().compare(argument1, argument2) to this? new NullSafeComparator(new ComparableComparator(), true).compare(argument1, argument2) and more performant to boot. Anyway, obviously I can live without them, but I'm curious about the rational behind the removal?=20 Thanks, Oliver |