Why is there a need of the 2 following methods in NumberFormat?
I see that NumberFormat has two methods very similar:
1)
abstract Number parse(String source, ParsePosition parsePosition)
Returns a Long if possible (e.g., within the range [Long.MIN_VALUE,
Long.MAX_VALUE] and with no decimals), otherwise a Double.
2)
Object parseObject(String source, ParsePosition pos)
Parses text from a string to produce a Number.
In presence of parse(s,ParseIndex) what would be the need of
parseObject(..) which needs to be cast to the desired output? I am aware
that the first method throws ParseException and the latter does not. Just
wondering why the need of these 2 very similar methods. Thanks in advance.
No comments:
Post a Comment