Top "Treeset" questions

a Java set implementation sorting its items upon insertion; provided by JRE/JDK.

I am able to insert duplicate entries in TreeSet. How to overcome this

I have a class called Employee which has employeeName and employeeId as its member variables.I am creating new Employee …

java treeset
Why adding null in HashSet does not throw Exception,but adding null in TreeSet throw Exception

Why adding null in HashSet does not throw Exception,but adding null in TreeSet throw Exception. Set<String> …

java hashset treeset
Why do we need a TreeMap/TreeSet when we have SortedMap/SortedSet?

Ok so SortedMap / SortedSet is an interface, and TreeMap / TreeSet is it's implementation. Both of them keep the elements in …

java treemap treeset
How can I use a custom class in a TreeSet?

If I was using a Set similar to this: Set<node> s=new TreeSet<node>(); class …

java treeset
Treeset.contains() problem

So I've been struggling with a problem for a while now, figured I might as well ask for help here. …

java contains treeset
Computational Complexity of TreeSet methods in Java

Is the computational complexity of TreeSet methods in Java, same as that of an AVLTree? Specifically, I want to know …

java algorithm data-structures avl-tree treeset
HashSet removes duplicates but TreeSet does not?

Output of below class is : size is 3 size is 1 But if I change the TreeSet to a HashSet so line : …

java hashset treeset
use of hashCode() and equals() in TreeSet and TreeMap

From the following code, I understand that, there is no need of overriding equals() and hashCode() method for TreeSet and …

java treemap treeset
Understanding TreeSet when compareto returns 0

I have created a Student class like this: public class Student implements Comparable<Student> { private String firstName; private …

java collections compareto treeset sortedset
TreeSet and equals function

There is a Java bean object which has implemented equals function based on certain criteria (Criteria A). I have a …

java equals comparator treeset