根据官方文档,DataProvider只能有2种类型的返回

Object[][]
Iterator<Object[]>

Example1:

@DataProvider(name = "test1")
public Object[][] createData1() {
 return new Object[][] {
   { "Cedric", new Integer(36) },
   { "Anne", new Integer(37)},
 };
}

Example2:

@DataProvider(name = "test2")
public static Iterator<Object[]> createData2() {
    List<Object[]> dataProvider = new ArrayList<Object[]>();
    dataProvider.add(new Object[] { "Cedric", new Integer(36) });
    dataProvider.add(new Object[] { "Anne", new Integer(37) });
    return dataProvider.iterator();
}

Example3:

@DataProvider(name = "test3", parallel = true)
public static Object[][] createData3() {
    List<String[]> item = new ArrayList<String[]>();
    item.add(new String[] { "1k", "runtimeTest.PeoplesoftY1" });
    item.add(new String[] { "20k", "runtimeTest.Peoplesoft_20k1Y1" });
    String[][] result = new String[item.size()][];
    return item.toArray(result);
}

Example4:

@DataProvider(name = "test4", parallel = true)
public static Object[][] createData4(Method m) {
    List<String[]> item = new ArrayList<String[]>();
    String queryStr, user;
    String parallel = "1";
    if (m.getName().contains("_") && m.getName().contains("Parallel")) {
        parallel = m.getName().split("_")[1];
    }
    System.out.println(m.getName() + " parallel=" + parallel);
    for (int i = 0; i < Integer.parseInt(parallel); i++) {
        if (i == 0) {
            queryStr = "*";
            user = "weblogic";
        } else {
            queryStr = "*" + i + "*";
            user = "puser" + i;
        }
        item.add(new String[] { queryStr, user });
    }
    Object[][] result = new Object[item.size()][];
    return item.toArray(result);
}

http://testng.org/doc/documentation-main.html