I\'m trying to add the below book objects to a TreeSet. However, when I debug the code, it says that the set has a size of 1 and only contains the first object added (book1). Wh
Update your compareTo method based on your requirement. Or at least update as below, it will allow to insert all objects in treeset.
public int compareTo(Book o) { // TODO Auto-generated method stub return this.compareTo(o); }