question about how to program this...
here is my situation..
i have a class I wrote. I need to be able to sort it easily on 3 different data
elements it holds. Meaning = sometimes i need a list of it sorted on data
element 1, sometimes on 2, but not always 3. Hence, i would like to be able
to put a switch statement in the equals function. However, since the equals
function has no way of receiving such a parameter, I need to figure out the
best way to do this.
The proposed solution: i have thought (and tried) just adding a static integer
that each class can look at to tell what type of sort to do. Problem: the problem i
have with this solution is that i use this class in lots of different places. it seems
like it would be bad programming practice to have a static data element that
was only true for the data elements I am sorting, but not true for the other ones.
My reasoning is that i can change the value of this element before any sort
is brought to pass. However, that seems a bit weird to me. Am I overreacting?
Is this, indeed, bad programming practice? Is there some solution available
to me that i've overlooked? any answers/suggestions/comments are greatly
appreciated.

