Introduced toClassArray(Collection<Class<?>>).

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@4464 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Sam Brannen 2011-06-05 19:13:13 +00:00
parent 0c787ff902
commit b8d36919f4
1 changed files with 14 additions and 1 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -950,6 +950,19 @@ public abstract class ClassUtils {
return sb.toString();
}
/**
* Copy the given Collection into a Class array.
* The Collection must contain Class elements only.
* @param collection the Collection to copy
* @return the Class array (<code>null</code> if the passed-in
* Collection was <code>null</code>)
*/
public static Class<?>[] toClassArray(Collection<Class<?>> collection) {
if (collection == null) {
return null;
}
return collection.toArray(new Class<?>[collection.size()]);
}
/**
* Return all interfaces that the given instance implements as array,