From 30c7313170e4d34570aedf7050f8fd43660bf0bb Mon Sep 17 00:00:00 2001 From: felmer <felmer> Date: Wed, 12 Sep 2007 12:20:12 +0000 Subject: [PATCH] allow any Iterable as argument of createBeanList() methods SVN: 1722 --- .../systemsx/cisd/common/utilities/BeanUtils.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/source/java/ch/systemsx/cisd/common/utilities/BeanUtils.java b/common/source/java/ch/systemsx/cisd/common/utilities/BeanUtils.java index 0a3d18bcb67..77ce5e7c098 100644 --- a/common/source/java/ch/systemsx/cisd/common/utilities/BeanUtils.java +++ b/common/source/java/ch/systemsx/cisd/common/utilities/BeanUtils.java @@ -153,38 +153,38 @@ public final class BeanUtils * Creates a new list of Beans of type <var>clazz</var>. * * @param clazz element type of the new list. - * @param sourceList The list to fill the new bean list from. Can be <code>null</code>, in which case the method + * @param source The iterable to fill the new bean list from. Can be <code>null</code>, in which case the method * returns <code>null</code>. * @return The new list filled from <var>sourceList</var> or <code>null</code>, if <var>sourceList</var> is * <code>null</code>. */ - public final static <T, S> List<T> createBeanList(Class<T> clazz, List<S> sourceList) + public final static <T, S> List<T> createBeanList(Class<T> clazz, Iterable<S> source) { - return createBeanList(clazz, sourceList, null); + return createBeanList(clazz, source, null); } /** * Creates a new list of Beans of type <var>clazz</var>. * * @param clazz element type of the new list. - * @param sourceList The list to fill the new bean list from. Can be <code>null</code>, in which case the method + * @param source The iterable to fill the new bean list from. Can be <code>null</code>, in which case the method * returns <code>null</code>. * @param converter The {@link Converter} to use to perform non-standard conversions when filling the bean. Can be * <code>null</code>, in which case only standard conversions are allowed. * @return The new list filled from <var>sourceList</var> or <code>null</code>, if <var>sourceList</var> is * <code>null</code>. */ - public final static <T, S> List<T> createBeanList(Class<T> clazz, List<S> sourceList, Converter converter) + public final static <T, S> List<T> createBeanList(Class<T> clazz, Iterable<S> source, Converter converter) { assert clazz != null; - if (sourceList == null) + if (source == null) { return null; } final List<T> resultList = new ArrayList<T>(); - for (S element : sourceList) + for (S element : source) { resultList.add(BeanUtils.createBean(clazz, element, converter)); } -- GitLab