Code example for Collection

Methods: toArray

0
	public static Set<String> asSet(String... strs) { 
		return new HashSet<String>(Arrays.asList(strs)); 
	} 
 
	public static Object[] collectionToSortedArray(Collection<? extends Object> objects) { 
		Object[] sortedArray = objects.toArray(new Object[] {}); 
		Arrays.sort(sortedArray, new Comparator<Object>() { 
 
			@Override 
			public int compare(Object o1, Object o2) { 
				return o1.toString().compareTo(o2.toString()); 
			} 
 
		}); 
		return sortedArray; 
	} 
 
}