Here you can find the source of convertCollectionInArray(Collection coll)
static public String[] convertCollectionInArray(Collection coll)
//package com.java2s; /* SpagoBI, the Open Source Business Intelligence suite /*from w ww.ja va2 s. co m*/ * Copyright (C) 2012 Engineering Ingegneria Informatica S.p.A. - SpagoBI Competency Center * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0, without the "Incompatible With Secondary Licenses" notice. * If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.util.Collection; import java.util.Iterator; public class Main { static public String[] convertCollectionInArray(Collection coll) { String[] array = new String[coll.size()]; int i = 0; for (Iterator iterator = coll.iterator(); iterator.hasNext();) { Object object = (Object) iterator.next(); String role = object.toString(); array[i] = role; i++; } return array; } }