J
John
I need to store hundreds of Components (a real mix of subclasses) in an
array/list, and need to be able to search the array for the presence of
a given Component . I therefore need to sort the array by some key which
is unique among components to avoid wasting lots of time doing equals()
comparisons.
At the moment I am considering sorting by Object.hashCode() and dealing
with conflicts by using equals() comparisons.
Does anyone have a better suggestion for doing this?
array/list, and need to be able to search the array for the presence of
a given Component . I therefore need to sort the array by some key which
is unique among components to avoid wasting lots of time doing equals()
comparisons.
At the moment I am considering sorting by Object.hashCode() and dealing
with conflicts by using equals() comparisons.
Does anyone have a better suggestion for doing this?