I do mean == (this also implies equals()), try running:
public class InternTest {
public static void main (String [] args) {
char [] buffer1 = {'a', 'b', 'c'};
char [] buffer2 = {'a', 'b', 'c'};
String one = new String(buffer1, 0, buffer1.length);
String two = new String(buffer2, 0, buffer2.length);
System.out.println(one.intern() == two.intern()); // true
}
}
Bob Foster <[EMAIL PROTECTED]> wrote on 03/17/2005 05:17:37 PM:
> Michael Glavassevich wrote:
> > When addSymbol is called with the same char argument you'll get the
same
> > string object, since:
> >
> > new String(buffer1, offset1, length1).intern() == new String(buffer2,
> > offset2, length2).intern()
> > if length1 == length2 and buffer1[offset1 + n] == buffer2[offset2 + n]
for
> > all n < length1.
>
> I think you described equals() not ==, yes?
>
> Bob Foster
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]