Re: comparing strings with ==

Date view Thread view Subject view Author view

From: Archie Cobbs (archie@whistle.com)
Date: Thu Sep 03 1998 - 15:44:17 EDT


Archie Cobbs writes:
> Does kaffe keep all String objects unique so that you can do this?
>
> + if (protocol == "ftp") {
> + port = 21;
> + }
>
> That's cool if it does... then can't we simplify String.equals() ?

A quick look at String.java shows that Strings are not "uniqified",
in which case java.net.URL.getDefaultPort() (whence this code snippet came)
is broken.

Would it be useful to change Kaffe to uniquify all strings (via
some sort of hashtable (possibly optimized with native code))?
I sortof remember that newer JDK's provided this (so you could
compare strings with ==).

Also, what's the status of INTERN_UTF8CONSTS and how does that
relate to this?

Curious,
-Archie

___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:56:54 EDT