I know in java we are supposed to use String.equals to compare the value of two string objects. However, I've been a C++ programmer for too long to remember that we can't use "==" to compare two strings. I keep making the same mistakes again, again and again.
I guess we couldn't overload an operator like the way we do in C++. I am developing android apps in eclipse. Is there anyway to create a lint rule to at least throw a warning when I attempt to use "==" to compare two Strings?
If you are using Android Studio, open the Preferences dialog, select Inspections, and search for "==". You will see a number of "Probable bugs" that you can checkmark. By the way, the option for Object comparisons does not cover Number or String comparisons.

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With