On 19/01/2012 00:38, Ulf Zibis wrote:
Am 18.01.2012 21:09, schrieb Joe Darcy:
Hi Roger,
On 01/18/2012 11:21 AM, Roger Riggs wrote:
1. In the new parsing methods, could the String arguments be changed
to the more general
java.lang.CharSequence? For many parsing applications, it could be
more convenient
to pass a CharSequence than to create a new String.
I don't think that would be very helpful in this case. If the
methods were changed to take a CharSequence, the first action I'd
write in the method would be to call toString on the argument; this
is necessary to guard against the class of
time-of-check-versus-time-of-use problems because the CharSequence
objects can be mutable.
Doesn't this argument make the usage of CharSequence in most other
API's inappropriate at all?
It depends. If the parsing requires backtracking then you have to be
careful or else parse a copy.
-Alan.