List of usage examples for java.util List toArray
<T> T[] toArray(T[] a);
From source file:Main.java
public static Object[] toArray(List aList, Class aType) { Object[] sameElementsArray = (Object[]) Array.newInstance(aType, aList.size()); return aList.toArray(sameElementsArray); }
From source file:Main.java
public static Class<?>[] toClasses(Object... args) { List<Class<?>> list = new ArrayList<Class<?>>(args.length); for (Object obj : args) list.add(obj.getClass());/*from w ww .j a v a 2 s .c o m*/ return list.toArray(new Class[list.size()]); }
From source file:Main.java
public static String[] drainToArray(Iterator<String> argsIter) { List<String> args = new ArrayList<>(); while (argsIter.hasNext()) { args.add(argsIter.next());//from w w w .j ava 2s. c om } return args.toArray(new String[args.size()]); }
From source file:org.sakaiproject.genericdao.springutil.ResourceFinder.java
/** * Resolves a list of paths into resources within the current classloader * @param paths a list of paths to resources (org/sakaiproject/mystuff/Thing.xml) * @return an array of Spring Resource objects *///from ww w . j a v a 2 s.com public static Resource[] getResources(List<String> paths) { List<Resource> l = makeResources(paths); return l.toArray(new Resource[l.size()]); }
From source file:Main.java
public static String[] popAtLast(String[] resource, int length) { List<String> list = new ArrayList<>(); for (int i = 0; i < length; i++) { list.add(resource[i]);/*from w ww. j a va 2 s. co m*/ } String[] result = list.toArray(resource); return result; }
From source file:edu.harvard.i2b2.crc.loader.datavo.CRCLoaderJAXBUtil.java
@SuppressWarnings("unchecked") public static edu.harvard.i2b2.common.util.jaxb.JAXBUtil getJAXBUtil() { if (jaxbUtil == null) { BeanFactory springBean = CRCLoaderUtil.getInstance().getSpringBeanFactory(); List jaxbPackageName = (List) springBean.getBean("jaxbPackage"); String[] jaxbPackageNameArray = (String[]) jaxbPackageName.toArray(new String[] { });/*from www. java2 s . c o m*/ jaxbUtil = new edu.harvard.i2b2.common.util.jaxb.JAXBUtil(jaxbPackageNameArray); } return jaxbUtil; }
From source file:Main.java
public static String toString(List<String> permission) { if (permission == null || permission.isEmpty()) { return ""; }// w w w. jav a2 s. c om return toString(permission.toArray(new String[permission.size()])); }
From source file:me.st28.flexseries.flexcore.util.ArrayUtils.java
/** * Convenience method for sublisting a string array into another string array object. * * @param array The original array./*from ww w. j a v a2s . c om*/ * @param startIndex The beginning index to include. * @param endIndex The ending index to include. * @return The new string array. */ public static String[] stringArraySublist(String[] array, int startIndex, int endIndex) { Validate.notNull(array); List<String> tempList = Arrays.asList(array).subList(startIndex, endIndex); return tempList.toArray(new String[tempList.size()]); }
From source file:com.wavemaker.commons.util.WMUtils.java
public static String[] getStringList(Object obj) { if (obj instanceof String) { return new String[] { (String) obj }; }/*from w w w . j a v a2s . c om*/ if (obj instanceof String[]) { return (String[]) obj; } if (obj instanceof List) { List o = (List) obj; return (String[]) o.toArray(new String[] {}); } throw new WMRuntimeException("obj of type " + obj.getClass() + " not supported by this method"); }
From source file:com.autentia.common.util.StringUtils.java
public static String[] generateArrayFromList(List<String> list) { String[] array = new String[list.size()]; array = list.toArray(array); return array; }