• 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.

The most annoying thing about Java

notfred

Lifer
string.equals(otherstring);

REALLY should be:

string == otherstring;

Object.equals() is stupid. Why is there no operator overlaoding in Java?

Just whining.
 
Why break the overal concept of == for reference comparison and .Equals() for object comparison only for strings? Strings are real objects afterall.

Lack of operator overloading simply means you need to be more verbose, the code is closer to self-documenting, and there's no "What the hell does ball*ball mean?" issues when someone else is reviewing the code later.
 
Originally posted by: Kilrsat
Why break the overal concept of == for reference comparison and .Equals() for object comparison only for strings? Strings are real objects afterall.

Lack of operator overloading simply means you need to be more verbose, the code is closer to self-documenting, and there's no "What the hell does ball*ball mean?" issues when someone else is reviewing the code later.

Yeah it wouldn't make sense to break the idea of not using operator overloading, except for the fact that strings already overload the '+' operator.
 
Because string == otherstring already has a strong semantic meaning that is in keeping with the rest of the language. By the same principle integer == otherinteger is also not a value-based comparison.
String concatentation is not a real overload because the compiler translates that directly into the construction of a StringBuffer object. The runtime environment has no notion of primitive String concatentation.
 
Back
Top