I don't see what I'm doing wrong, unless ArrayList compares hash codes instead of using Comparable.equals(Comparable) as it says it does in the documentation:

java Code:

More formally, returns trueif and only ifthis list contains at least one element e such that
(o==null? e==null: o.equals(e))
taken from java.sun.com's SE 6 API for java.util.ArrayList

Chat Server Project & Tutorial | WiFi-remote-control sailboat (building) | Joke Thread
“Rational thinkers deplore the excesses of democracy; it abuses the individual and elevates the mob. The death of Socrates was its finest fruit.”
Use XXX in a comment to flag something that is bogus but works. Use FIXME to flag something that is bogus and broken. Use TODO to leave yourself reminders. Calling a program finished before all these points are checked off is lazy.
-Partial Credit: Sun

If I ask you to redescribe your problem, it's because when you describe issues in detail, you often get a *click* and you suddenly know the solutions.
Ches Koblents

//the contains method just checks to see if the value returned from publicint indexOf(Object elem){if(elem ==null){for(int i =0; i < size; i++)if(elementData[i]==null)return i;}else{for(int i =0; i < size; i++)if(elem.equals(elementData[i]))return i;}return-1;}

It looks pretty straightforward. What does your equals method look like?
I would run this through a debugger or add printlns in your equals method

Both. It's your bug and your fault. Mind you, I'm not saying that to be cruel or harsh, but the sooner you realize that the software problems you have are caused by the code you write, the better developer you'll be - by a long shot.

[EDIT] Just realized the OP is gimp. Gimp, you know better!

Please post an actual SSCCE; i.e., the bare minimum amount of code that compiles, runs, and correctly demonstrates only the problem and nothing else (please read the link to make sure you understand). That way, we can see the actual implementation you've employed and can get you pointed in the right direction.

You need to include your equals method, as it may not be symmetric. Also, you should always implement hashCode() when implementing equals(), as per the general contract.

Note that it is generally necessary to override the <tt>hashCode</tt> method whenever this method is overridden, so as to maintain the general contract for the <tt>hashCode</tt> method, which states that equal objects must have equal hash codes.

because room1.equals(room2) returns true, I thought this should also return true. Guess I shoulda used a hashcode.

Since the problem was fixed, this is for posterity...

Chat Server Project & Tutorial | WiFi-remote-control sailboat (building) | Joke Thread
“Rational thinkers deplore the excesses of democracy; it abuses the individual and elevates the mob. The death of Socrates was its finest fruit.”
Use XXX in a comment to flag something that is bogus but works. Use FIXME to flag something that is bogus and broken. Use TODO to leave yourself reminders. Calling a program finished before all these points are checked off is lazy.
-Partial Credit: Sun

If I ask you to redescribe your problem, it's because when you describe issues in detail, you often get a *click* and you suddenly know the solutions.
Ches Koblents

The problem is that you have not overriden Object#equals(Object o), but instead implemented a seperate ChatRoom#equals(ChatRoom o) method. This is where the @Override annotation can be quite handy, though with experience you'll rarely find yourself hitting this mistake.

I recommend you read "Effective Java" to understand the importance of a good equals()/hashCode() contract.