mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8312411: MessageFormat.formatToCharacterIterator() can be improved
Reviewed-by: naoto
This commit is contained in:
parent
e2cb0bc6f1
commit
23755f90c9
1 changed files with 2 additions and 6 deletions
|
@ -948,20 +948,16 @@ public class MessageFormat extends Format {
|
|||
* @since 1.4
|
||||
*/
|
||||
public AttributedCharacterIterator formatToCharacterIterator(Object arguments) {
|
||||
Objects.requireNonNull(arguments, "arguments must not be null");
|
||||
StringBuffer result = new StringBuffer();
|
||||
ArrayList<AttributedCharacterIterator> iterators = new ArrayList<>();
|
||||
|
||||
if (arguments == null) {
|
||||
throw new NullPointerException(
|
||||
"formatToCharacterIterator must be passed non-null object");
|
||||
}
|
||||
subformat((Object[]) arguments, result, null, iterators);
|
||||
if (iterators.size() == 0) {
|
||||
return createAttributedCharacterIterator("");
|
||||
}
|
||||
return createAttributedCharacterIterator(
|
||||
iterators.toArray(
|
||||
new AttributedCharacterIterator[iterators.size()]));
|
||||
iterators.toArray(new AttributedCharacterIterator[0]));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue