• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

== (still) != ".equal()"

AFB

Lifer
I was using a JTree to keep data that expires and then I get a list of things that can be revalidated in the tree. The items in the list are "equal()" to the items in the tree, but they aren't the same object. The items in the tree has a method to update the time expiration and a method to see if it's expired that is polled by the same thread. Well, I was trying to update the expiration time of the objects in the list, while still checking the JTree forobejcts that expired.


1.5 hours wasted - I feel owned 😱
 
i'm not too sure what you're saying. but i believe equals is a method that is called for two icomparables that generally checks one or more fields and returns a bool.

you can have
string a = "pie";
string b = "pie";

a.equals(b) will still come out true.
then again, you only need to use equals() if you're in java. newer languages will work properly with just '=='. if you're using java and you use the ==, then it checks the pointer, even so it's not necessarily the same object.

string a, b;
a = b //string a now points to the same thing as b
a == b will return true;
 
Yea, in Python == just checks the data for equality. "is" and "is not" check to see if the two identifiers are pointing to the same object.
 
Originally posted by: kbirger
i'm not too sure what you're saying. but i believe equals is a method that is called for two icomparables that generally checks one or more fields and returns a bool.

you can have
string a = "pie";
string b = "pie";

a.equals(b) will still come out true.
then again, you only need to use equals() if you're in java. newer languages will work properly with just '=='. if you're using java and you use the ==, then it checks the pointer, even so it's not necessarily the same object.

string a, b;
a = b //string a now points to the same thing as b
a == b will return true;

Don't worry. He knows the difference 🙂 He's just venting because he made a silly mistake.
 
Back
Top