Am 04.01.2010 17:42, Jesús Viñuales schrieb:
Hi Alex,
String.equals already performs that instanceof comparison, and is one of the first to be inlined by
the hotspot. What I would do is to turn it... "this.equals(cs)" instead of
"cs.equals(this)".
Why always waiting for HotSpot inlining to have Java fast? If not
invoked so often, interpreter too should be fast as it can.
-Ulf
Which would only improve performance if you have classes implementing
CharSequence other than String, StringBuilder and StringBuffer... Anyway, does
anyone know if the contentEquals method is actually used out there? (at least
it isn't inside the JDK source code).
Regards,
--Jesus
Alexander Veit wrote:
Hi,
it seems that
if (cs.equals(this))
return true;
should be replaced with
if (cs instanceof String)
return cs.equals(this);
or completely left out.
Does anyone agree?
--
Cheers,
Alex