Categories
Core JAVA

HashSet and TreeSet in Java

HashSet and TreeSet both are present in java. util package.Both evaluate on the basis of object values, not on the basis of the index.Both cannot store any duplicate index. HashSet is faster than TreeSet and it should be the preferred choice if sorting of the element is not required. Difference:- HashSet store in random order […]