What is a faster method of checking to see if a new element already exists in a collection than using the equals() method on each element?
Answer: Use the hashCode() element on all members of the collection, sorting all elements with equal hashes in a single bucket. If the hash of a new element matches that of an existing bucket, the equals() method can be used on all the contents of the bucket.
If the answers is incorrect or not given, you can answer the above question in the comment box. If the answers is incorrect or not given, you can answer the above question in the comment box.