On 26.06.2005 14:41:13 Glen Mazza wrote: <snip/> > >Well, the whole idea behind using interned strings and the == operator is > >speed. > >As you both are probably well aware, using .equals() on interned strings is > >a lot slower than comparing them with ==. > > > > > > > > Not necessarily--I suspect implementations of .equals() probably first > check if they == each other, and if so quickly return true before trying > a character-by-character compare.
Glen is right. java.lang.String.equals() checks "==" as the first statement. So this change shouldn't have a big impact on performance. It' just an additional method call (which might even be inlined by the JIT). Jeremias Maerki
