Java examples for Collection Framework:Array Convert
Convert object List To Object ArrayList
import java.util.ArrayList; import java.util.List; public class Main{ public static void main(String[] argv){ List objList = java.util.Arrays.asList("asdf","java2s.com"); String fieldNames = "java2s.com"; System.out.println(java.util.Arrays.toString(objListToObjArrayList(objList,fieldNames))); }/*from w ww . j a v a 2 s . c o m*/ public static <T> List<Object[]> objListToObjArrayList(List<T> objList, String... fieldNames) { List<Object[]> objArrayList = new ArrayList<Object[]>(); for (T obj : objList) { objArrayList.add(ObjectUtil.objToFieldValueArray(obj, fieldNames)); } return objArrayList; } }