public final class ListFormatter
extends java.lang.Object
| Constructor and Description |
|---|
ListFormatter(java.lang.String two,
java.lang.String start,
java.lang.String middle,
java.lang.String end)
Internal: Create a ListFormatter from component strings,
with definitions as in LDML.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
format(java.util.Collection<java.lang.Object> items)
Format a collection of objects.
|
java.lang.String |
format(java.lang.Object... items)
Format a list of objects.
|
static ListFormatter |
getInstance()
Create a list formatter that is appropriate for the default FORMAT locale.
|
static ListFormatter |
getInstance(java.util.Locale locale)
Create a list formatter that is appropriate for a locale.
|
static ListFormatter |
getInstance(ULocale locale)
Create a list formatter that is appropriate for a locale.
|
public ListFormatter(java.lang.String two,
java.lang.String start,
java.lang.String middle,
java.lang.String end)
two - string for two items, containing {0} for the first, and {1}
for the second.start - string for the start of a list items, containing {0} for the
first, and {1} for the rest.middle - string for the start of a list items, containing {0} for the
first part of the list, and {1} for the rest of the list.end - string for the end of a list items, containing {0} for the
first part of the list, and {1} for the last item.public static ListFormatter getInstance(ULocale locale)
locale - the locale in question.public static ListFormatter getInstance(java.util.Locale locale)
locale - the locale in question.public static ListFormatter getInstance()
public java.lang.String format(java.lang.Object... items)
items - items to format. The toString() method is called on each.public java.lang.String format(java.util.Collection<java.lang.Object> items)
items - items to format. The toString() method is called on each.Copyright (c) 2012 IBM Corporation and others.