If set accepts only one argument then how can it compare
two objects to avoid duplicates

Answer Posted / r.jainrocks@gmail.com

Set compares hash code of new instance which
has to include in set with already containing values in Set.

because of this comparing b/w instances adding in set is slow
in Set and retrieval is fast.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by attribute?

599


Implementations of set interface?

569


Is it compulsory for a try block to be followed by a catch block in java for exception handling?

597


Can constructor return value?

512


how to convert Java project into Maven ?

588






What is the mapping mechanism used by java to identify IDL language?

593


What do bitwise operators do?

532


Is string a class in java?

513


Does the order of public and static declaration matter in main method?

621


Which variables are stored in heap?

544


What is hasnext in java?

582


Can java arraylist hold different types?

500


How to use string tokenizer class.

624


What is this keyword in java?

569


What is an eror in java?

561