"I'm not back." - Bill Harding, Twister
Originally posted by Michael Matola:
Here's what I think Jim had in mind:
void sortByFullName( List list )
{
Collections.sort( list , SortEngine.FULLNAME );
}
But since you've made FULLNAME coderanch, clients can just as easily call
Collections.sort( list , SortEngine.FULLNAME );
themselves as they can call sortByFullName( list );
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Originally posted by Ilja Preuss:
OTOH, it would be bad to spread the latter over your client code. It'd be a very good idea to encapsulate the call to Collections.sort - just imagine what happened if you later wanted to change the sorting algorithm.
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Originally posted by Marilyn de Queiroz:
I agree if you are going to use Collections.sort more than once or if you do decide to change the sorting algorithm.
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
"I'm not back." - Bill Harding, Twister
Don't get me started about those stupid light bulbs. |