public final class ListFormatter extends Object
| Constructor and Description |
|---|
ListFormatter(String two,
String start,
String middle,
String end)
Internal: Create a ListFormatter from component strings,
with definitions as in LDML.
|
| Modifier and Type | Method and Description |
|---|---|
String |
format(Collection<Object> items)
Format a collection of objects.
|
String |
format(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(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(String two, String start, String middle, 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(Locale locale)
locale - the locale in question.public static ListFormatter getInstance()
public String format(Object... items)
items - items to format. The toString() method is called on each.public String format(Collection<Object> items)
items - items to format. The toString() method is called on each.Copyright (c) 2012 IBM Corporation and others.