Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
I don't think you have to have all the same class to use Comparable - just compatible classes that won't throw exceptions when asked to compare to each other.
)? And while it is not part of the general contract of Comparable that the compared objects have a common ancestry, one should be wary of the avenue of abuse that sort of coding opens up. If I say it is OK to compare a Foo with a Bar and they are only related thru Object, then in my humble opinion, I'm following the same old bad practices I used to follow when coding in C++ when I used operator overloading to accomplish a task totally unrelated to the particular operator.Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
"JavaRanch, where the deer and the Certified play" - David O'Meara
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
you might push the comparison up to the fruit class. But if fruit already supports comparison on price, you might have to override compareTo on apple and orange.A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
The reason was that Vector is an older, effectively superseded class which pre-dates the Collections framework.Originally posted by Kelly KMoni:
I remember reading somewhere that using Vector is not a good idea, I am not sure of the reason though. [...]
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
