Let's find out answer of few very important questions before proceeding >
Q1. How HashSet implements hashing?
Q2. How add method works internally?
A. public void add(E value){
hashMapCustom.put(value, null);
}
Q3. How contains method works internally?
A. public boolean contains(E obj){
return hashMapCustom.contains(obj) !=null ? true :false;
}
Q4. How remove method works internally?
A. public boolean remove(E obj){
return hashMapCustom.remove(obj);
}
Read full article from JavaMadeSoEasy.com: Set Custom implementation in java - How HashSet works internally with diagrams and full program
No comments:
Post a Comment