/*
*******************************************************************************
- * Copyright (C) 2012-2012, Google, International Business Machines Corporation and
+ * Copyright (C) 2012-2013, Google, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
* @draft ICU 50
* @provisional This API might change or be removed in a future release.
*/
- public String format(Collection<Object> items) {
+ public String format(Collection<?> items) {
// TODO optimize this for the common case that the patterns are all of the
// form {0}<sometext>{1}.
// We avoid MessageFormat, because there is no "sub" formatting.
- Iterator<Object> it = items.iterator();
+ Iterator<?> it = items.iterator();
int count = items.size();
switch (count) {
case 0:
/*
*******************************************************************************
- * Copyright (C) 2012-2012, Google, International Business Machines Corporation and
+ * Copyright (C) 2012-2013, Google, International Business Machines Corporation and
* others. All Rights Reserved.
*******************************************************************************
*/
package com.ibm.icu.dev.test.format;
+import java.util.ArrayList;
import java.util.Locale;
import com.ibm.icu.dev.test.TestFmwk;
assertEquals("4", strings[4], listFormat.format("A", "B", "C", "D"));
assertEquals("5", strings[5], listFormat.format("A", "B", "C", "D", "E"));
}
+
+ public void TestFromList() {
+ ListFormatter listFormatter = ListFormatter.getInstance(ULocale.ENGLISH);
+ ArrayList<String> list = new ArrayList<String>();
+ list.add("A");
+ list.add("B");
+ list.add("C");
+ assertEquals("list", "A, B, and C", listFormatter.format(list));
+ }
private boolean isDefaultLocaleEnglishLike() {
ULocale defaultLocale = ULocale.getDefault(ULocale.Category.FORMAT);