One last try, to support usages in yohoho, as advised by Michael Thomas.

git-svn-id: https://samskivert.googlecode.com/svn/trunk@2648 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
ray.j.greenwell
2009-11-19 23:47:48 +00:00
parent a0425478d6
commit dd4f8da52a
@@ -37,7 +37,7 @@ public class CollectionUtil
* Adds all items returned by the enumeration to the supplied collection * Adds all items returned by the enumeration to the supplied collection
* and returns the supplied collection. * and returns the supplied collection.
*/ */
public static <T> Collection<T> addAll (Collection<T> col, Enumeration<? extends T> enm) public static <T, C extends Collection<T>> C addAll (C col, Enumeration<? extends T> enm)
{ {
while (enm.hasMoreElements()) { while (enm.hasMoreElements()) {
col.add(enm.nextElement()); col.add(enm.nextElement());
@@ -49,7 +49,7 @@ public class CollectionUtil
* Adds all items returned by the iterator to the supplied collection and * Adds all items returned by the iterator to the supplied collection and
* returns the supplied collection. * returns the supplied collection.
*/ */
public static <T> Collection<T> addAll (Collection<T> col, Iterator<? extends T> iter) public static <T, C extends Collection<T>> C addAll (C col, Iterator<? extends T> iter)
{ {
while (iter.hasNext()) { while (iter.hasNext()) {
col.add(iter.next()); col.add(iter.next());
@@ -62,7 +62,7 @@ public class CollectionUtil
* returns the supplied collection. If the supplied array is null, nothing * returns the supplied collection. If the supplied array is null, nothing
* is added to the collection. * is added to the collection.
*/ */
public static <T, E extends T> Collection<T> addAll (Collection<T> col, E[] values) public static <T, E extends T, C extends Collection<T>> C addAll (C col, E[] values)
{ {
if (values != null) { if (values != null) {
for (E value : values) { for (E value : values) {