_TreeSet_.remove(_TreeSet_.first()) == false
From: Tommy Jack (null-n-void_at_satx.rr.com)
Date: 04/30/04
- Next message: Andrew Thompson: "Re: Please help!"
- Previous message: martim07: "Re: Unzipping Files With Java"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Apr 2004 02:10:24 GMT
I've been trying to figure this out for a while now: I have a TreeSet
with a bunch of Objects in it. The reference to the TreeSet is nodeSet. When
I run the following code:
System.out.println(nodeSet.remove(first));
I see false printed out. false! It just doesn't make sense that a
TreeSet would tell me it can't find it's own first element. I must be making
a really stupid mistake...
I naturally assumed it was a problem with my objects' equals() or
compareTo() methods. So, I did a test run of these methods:
Node first = (Node)nodeSet.first();
System.out.println(first.equals(first));
System.out.println(first.compareTo(first));
The output is true and 0. Just like it's supposed to be, right? So why
would a TreeSet say "false"?!
ahhhh
- Next message: Andrew Thompson: "Re: Please help!"
- Previous message: martim07: "Re: Unzipping Files With Java"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]