Re: String.subSequence and CR#6924259: Remove offset and count fields from java.lang.String

2012-06-27 Thread Peter Levart
Hi Mike, Yes, all that you say below is true. CharSequence is an interface that does not define the contract of identity when implementations/subtypes of CharSequence do - each in it's own way. Much like java.util.Collection and List vs. Set. It's always dangerous for methods that return such i

Re: String.subSequence and CR#6924259: Remove offset and count fields from java.lang.String

2012-06-26 Thread Martin Desruisseaux
Le 26/06/12 20:10, Mike Duigou a écrit : StringBuilder.append(string.substring(lower, upper)); by: StringBuilder.append(string, lower, upper); This would seem to be a good refactoring regardless of the substring implementation as it avoids creation of a temporary object. The ratio

Re: String.subSequence and CR#6924259: Remove offset and count fields from java.lang.String

2012-06-26 Thread Mike Duigou
On Jun 26 2012, at 07:13 , Martin Desruisseaux wrote: > If String.substring(int, int) now performs a copy of the underlying char[] > array and if there is no String.subSequence(int, int) providing the old > functionality, maybe the following implications should be investigated? > > > StringBu

Re: String.subSequence and CR#6924259: Remove offset and count fields from java.lang.String

2012-06-26 Thread Martin Desruisseaux
If String.substring(int, int) now performs a copy of the underlying char[] array and if there is no String.subSequence(int, int) providing the old functionality, maybe the following implications should be investigated? StringBuilder.append(...) Since, in order to avoid a

Re: String.subSequence and CR#6924259: Remove offset and count fields from java.lang.String

2012-06-25 Thread Alan Bateman
On 22/06/2012 23:15, Mike Duigou wrote: : - The CharSequences returned by subSequence would follow only the general CharSequence rules for equals()/hashCode(). Any current usages of the result of subSequence for equals() or hashing, even though it's not advised, would break. We could add equal

Re: String.subSequence and CR#6924259: Remove offset and count fields from java.lang.String

2012-06-24 Thread Mike Duigou
nIndex, > endIndex).asReadOnlyBuffer()' ? Easy to implement and test. The nice thing > is that parsers would know what a 'CharBuffer' vs. a sub sequence String > internal class. > > Jason > > > Subject: String.subSequence and CR#6924259: Remove of

RE: String.subSequence and CR#6924259: Remove offset and count fields from java.lang.String

2012-06-24 Thread Jason Mehrens
ring.subSequence and CR#6924259: Remove offset and count fields > from java.lang.String > From: [email protected] > Date: Fri, 22 Jun 2012 15:15:40 -0700 > To: [email protected] > CC: [email protected] > > I've made a test implementation of subS

String.subSequence and CR#6924259: Remove offset and count fields from java.lang.String

2012-06-22 Thread Mike Duigou
I've made a test implementation of subSequence() utilizing an inner class with offset and count fields to try to understand all the parts that would be impacted. My observations thus far: - The specification of the subSequence() method is currently too specific. It says that the result is a sub