diff --git a/src/java/org/apache/commons/collections/CollectionUtils.java b/src/java/org/apache/commons/collections/CollectionUtils.java index 078202593..ce02226aa 100644 --- a/src/java/org/apache/commons/collections/CollectionUtils.java +++ b/src/java/org/apache/commons/collections/CollectionUtils.java @@ -804,11 +804,12 @@ public class CollectionUtils { * @param enumeration the enumeration of elements to add, must not be null * @throws NullPointerException if the collection or enumeration is null */ - //TODO return boolean or collection - check other add() methods too. - public static void addAll(Collection collection, Enumeration enumeration) { + public static boolean addAll(Collection collection, Enumeration enumeration) { + boolean changed = false; while (enumeration.hasMoreElements()) { - collection.add(enumeration.nextElement()); + changed |= collection.add(enumeration.nextElement()); } + return changed; } /** @@ -821,10 +822,12 @@ public class CollectionUtils { * @throws NullPointerException * if the collection or array is null */ - public static void addAll(Collection collection, C[] elements) { + public static boolean addAll(Collection collection, C[] elements) { + boolean changed = false; for (int i = 0, size = elements.length; i < size; i++) { - collection.add(elements[i]); + changed |= collection.add(elements[i]); } + return changed; } /**