RE: java.lang.String#contentEquals(CharSequence) suboptimal?

2010-01-04 Thread Jesús Viñuales
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). Which would only improve performance if you have classes implementing CharSequence other than

RE: java.lang.String#contentEquals(CharSequence) suboptimal?

2010-01-04 Thread Jesús Viñuales
That's true, but given cs is a String with length equal to this, cs.equals(this) nevertheless may return false, and if (cs.equals(this)) return true; will not return. The remaining code performs the comparison a second time in this case. Oh, now I see it - you are absolutely right

RE: Gap Buffer based AbstractStringBuilder implementation

2009-11-22 Thread Jesús Viñuales
Osvaldo Doederlein wrote: Em 22/11/2009 05:55, Thomas Hawtin escreveu: There is a security issue there. When multiple threads are involved, it is possible (though not necessily easy) to create a mutable String if the backing char[] is shared. Tom Hawtin That's true. But there's

RE: nonNull and similar methods [was Re: First round of java.util.Objects for code review (bug 6797535)]

2009-10-14 Thread Jesús Viñuales
I agree with Stephen. There are a slew of validation methods that would be beneficial, and if you really want to drive the JDK towards standard validation, refactor them out into a Validation class. Look at what Spring has written for themselves:

RE: Adding a fixate method to StringBuilder and StringBuffer.

2009-04-16 Thread Jesús Viñuales
Paolo, Look at this bug evaluation http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6219959 to get further information about what Tom told you yesterday. I'm afraid that there is nothing to do here... because an optimization based on buffer-sharing + copy-on-write has several problems

RE: API change proposal: String concatenation boost

2008-09-30 Thread Jesús Viñuales
Hi all. I have measured the number of AbstractStringBuilder method invocations when executing NetBeans 6 (and making some work for 5 minutes) and when executing for a while a Glassfish V2 with a typical web application (Struts+Spring+Hibernate). These are the interesting and empirical results: