|
Ron, I'm not quite sure what your last "if" statement was. It was garbled by my Notes mail reader: if ((vector2.indexOf((BulkGarbageSchedDetail)vector.get(i)))<0){ result = false; } But I'm guessing that your feeling about overriding equals is right. You will need to create some custom code to distinguish between the elements in the list. You will need to identify one or a group of key attributes that would always distinguish one element instance from another. The question is what to override. Do you really need to use a Vector? Vectors are somewhat deprecated, as they have thread-safe synchronization built into them, and can thus be slow in some circumstances. The List family of collections is usually preferred. But do you want an ordered List or an unordered List? There might be some advantage in having your elements automatically sorted as they are inserted, or checked for uniqueness, but that's up to you. Anyway, what it comes down to is, do you override Object.equals, or create a Comparator class? Use the Comparator class if you are ever going to sort your collection. If not, then override Object.equals. But if you do go the Object.equals route, make sure to override Object.hashCode as well. Your elements may get stored in a hash table, either by your code or some library code. Hash tables are used by almost everything, even Properties. Unless you have also overridden hashTable, you may have some weird behavior to try and figure out. Good luck! _________________________________________________________________ Jeff Furgal / MIMIX Product Architect / Lakeview Technology furgalj@xxxxxxxxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.