-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
1.4.2
-
x86
-
linux
Name: rmT116609 Date: 11/10/2003
A DESCRIPTION OF THE REQUEST :
Now that the CharSequence interface exists, the parameters of numeric parse
methods (e.g., Integer.parseInt(String)) should probably be changed from
type String to type CharSequence.
This applies to:
* The java.lang.<numeric type> classes:
- Byte.parseByte(...) methods
- Short.parseShort(...) methods
- Integer.parseInt(...) methods
- Long.parseLong(...) methods
- Float.parseFloat(...) method
- Double.parseDouble(...) method
* java.util.Format classes:
- java.util.Format.parseObject(...)
- subclass parse(...) methods
JUSTIFICATION :
If nothing else, this change seems like something that should have been done
with the introduction of CharSequence in the first place.
Particularly, it would allow calling the numeric parse methods without having
to create a String object containing just the numeric characters (for example
if the caller has a character array, or a bigger String, within which it has
identified the position of numeric characters).
(Incident Review ID: 224683)
======================================================================
###@###.### 10/28/04 01:10 GMT
In addition to the parse methods, bug 4838318 also requests that the following numeric methods also have CharSequence parameters:
Integer(String s)
Integer.valueOf(String s)
Double(String s)
Clearly this recommendation would need to be applied to all of the wrapper classes, not just Integer and Double.
A DESCRIPTION OF THE REQUEST :
Now that the CharSequence interface exists, the parameters of numeric parse
methods (e.g., Integer.parseInt(String)) should probably be changed from
type String to type CharSequence.
This applies to:
* The java.lang.<numeric type> classes:
- Byte.parseByte(...) methods
- Short.parseShort(...) methods
- Integer.parseInt(...) methods
- Long.parseLong(...) methods
- Float.parseFloat(...) method
- Double.parseDouble(...) method
* java.util.Format classes:
- java.util.Format.parseObject(...)
- subclass parse(...) methods
JUSTIFICATION :
If nothing else, this change seems like something that should have been done
with the introduction of CharSequence in the first place.
Particularly, it would allow calling the numeric parse methods without having
to create a String object containing just the numeric characters (for example
if the caller has a character array, or a bigger String, within which it has
identified the position of numeric characters).
(Incident Review ID: 224683)
======================================================================
###@###.### 10/28/04 01:10 GMT
In addition to the parse methods, bug 4838318 also requests that the following numeric methods also have CharSequence parameters:
Integer(String s)
Integer.valueOf(String s)
Double(String s)
Clearly this recommendation would need to be applied to all of the wrapper classes, not just Integer and Double.
- relates to
-
JDK-4838318 (str) add StringBuilder.indexOf(CharSequence) and related
-
- Open
-
-
JDK-5084266 Add capability to parse char[] to the Number subclasses
-
- Closed
-