Ben,
You haven't overridden your .equals() method on the Class of newobject (this requirement is described in the List.equals() javadoc)
OR
you have implemented .equals() but your implementation has a bug in it.
James
PS: Remember that if you override .equals() you should also override .hashCode() as per the contract described in the javadoc.
On Tue, Jul 1, 2008 at 9:24 PM, Bcuthbe <
ben_cuthbert@...> wrote:
All i have my list, and when i download new data i want to check if the list
already has a certain object.
So if i do the following it does not work.
if(list.contains(newobject){
System.out.println("List already has this object in it.");
} else {
System.out.println("LIst does not have this object");
}
Is there another way to test the list to check if it has an object ?
--
View this message in context: http://www.nabble.com/List-contains-object-tp18230048p18230048.html
Sent from the GlazedLists - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...