Hello Everyone, This is the first time I am writing mail to this group, hence please ignore my nuisance and guide me towards right direction.
As suggested by Martin, I believe documentation need to be updated. I would happy to update the documentation, please provide your inputs. I have attache the .java file for more details. @Martin : I really appreciate your advice and help, thank you. Thank you, Kishor Gollapalliwar On Sat, Oct 13, 2018 at 11:40 PM Martin Buchholz <marti...@google.com> wrote: > core-libs-dev is the right mailing list. > > The documentation could be improved, but it's nuanced - consider using a > TreeSet with a Comparator that accepts null. > > On Sat, Oct 13, 2018 at 7:26 AM, Kishor Gollapalliwar < > kishor.gollapalli...@gmail.com> wrote: > >> Hello Everyone, >> >> Introduction : I’m an enthusiast java developer. I’m a newbie in this >> group, hence please ignore my nuisance and guide me towards right >> direction. >> >> ## Problems Statement >> >> Treeset#add method documentations : “adds the specified element e to this >> set if the set contains no element e2 such that (e==null ? e2==null : >> e.equals(e2))” >> >> Inconsistencies: >> >> > If we try to add “null” value, it will throws NullPointerException, >> hence >> > e and e2 can not be null. >> >> >> >> > And e.compareTo(e2) ==0 || compare(e, e2)==0, it will not add to >> > collection. >> >> >> Request you to help me understand if behavior of Treeset#add method is as >> expected, and differ with set interface documentation. We may have to >> consider to update method documentations, if behavior is expected. >> >> For more details I have attached the sample java application. >> >> I’ve tested the behavior on Orack JDK 8u181 (64 bit) and Open JDK 8u181. >> >> Thanks & Regards, >> *Kishor Golapelliwar,* >> The ability to convert ideas to things is the secret to outward success. >> > > -- Thanks & Regards, *Kishor Golapelliwar,* The ability to convert ideas to things is the secret to outward success.