# Print output for @column tags ?>
public
final
class
ListFormatter
extends Object
java.lang.Object | |
↳ | android.icu.text.ListFormatter |
Immutable class for formatting a list, using data from CLDR (or supplied separately). The class is not subclassable.
Public methods | |
---|---|
String
|
format(Object... items)
Format a list of objects. |
String
|
format(Collection<?> items)
Format a collection of objects. |
static
ListFormatter
|
getInstance(ULocale locale)
Create a list formatter that is appropriate for a locale. |
static
ListFormatter
|
getInstance(Locale locale)
Create a list formatter that is appropriate for a locale. |
static
ListFormatter
|
getInstance()
Create a list formatter that is appropriate for the default FORMAT locale. |
String
|
getPatternForNumItems(int count)
Returns the pattern to use for a particular item count. |
Inherited methods | |
---|---|
public String format (Object... items)
Format a list of objects.
Parameters | |
---|---|
items |
Object : items to format. The toString() method is called on each. |
Returns | |
---|---|
String |
items formatted into a string |
public String format (Collection<?> items)
Format a collection of objects. The toString() method is called on each.
Parameters | |
---|---|
items |
Collection : items to format. The toString() method is called on each. |
Returns | |
---|---|
String |
items formatted into a string |
public static ListFormatter getInstance (ULocale locale)
Create a list formatter that is appropriate for a locale.
Parameters | |
---|---|
locale |
ULocale : the locale in question. |
Returns | |
---|---|
ListFormatter |
ListFormatter |
public static ListFormatter getInstance (Locale locale)
Create a list formatter that is appropriate for a locale.
Parameters | |
---|---|
locale |
Locale : the locale in question. |
Returns | |
---|---|
ListFormatter |
ListFormatter |
public static ListFormatter getInstance ()
Create a list formatter that is appropriate for the default FORMAT locale.
Returns | |
---|---|
ListFormatter |
ListFormatter |
public String getPatternForNumItems (int count)
Returns the pattern to use for a particular item count.
Parameters | |
---|---|
count |
int : the item count. |
Returns | |
---|---|
String |
the pattern with {0}, {1}, {2}, etc. For English, getPatternForNumItems(3) == "{0}, {1}, and {2}" |
Throws | |
---|---|
IllegalArgumentException |
when count is 0 or negative. |