net.sf.jga.util
Class CollectionUtils

java.lang.Object
  extended by net.sf.jga.util.CollectionUtils

public class CollectionUtils
extends java.lang.Object

General utilites for working with collections. These are generally extensions to what's already defined in the standard java.util.Collection class

Copyright © 2006 David A. Hall

Author:
David A. Hall

Constructor Summary
CollectionUtils()
           
 
Method Summary
static
<T> boolean
addAll(java.util.Collection<? super T> cout, java.util.Iterator<T> iter)
          Adds all of the elements of the iterator to the collection.
static
<T> boolean
addAll(java.util.Collection<? super T> cout, T... values)
          Adds all of the arguments to the collection.
static
<T,TCollection extends java.util.Collection<? super T>>
TCollection
append(TCollection cout, java.lang.Iterable<T> iterable)
          Adds all of the elements of the iterable resource to the collection and returns the collection.
static
<T,TCollection extends java.util.Collection<? super T>>
TCollection
append(TCollection cout, java.util.Iterator<T> iter)
          Adds all of the elements of the iterator to the collection and returns the collection.
static
<T,TCollection extends java.util.Collection<? super T>>
TCollection
append(TCollection cout, T... values)
          Adds all of the arguments to the collection and returns the collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CollectionUtils

public CollectionUtils()
Method Detail

addAll

public static <T> boolean addAll(java.util.Collection<? super T> cout,
                                 java.util.Iterator<T> iter)
Adds all of the elements of the iterator to the collection. If necessary and possible, the collection will be enlarged: if enlarging the collection is not possible, then a runtime exception will be thrown. This is an augmentation of the Collection.addAll(Collection) API method.

Returns:
true if the state of the collection was changed.

addAll

public static <T> boolean addAll(java.util.Collection<? super T> cout,
                                 T... values)
Adds all of the arguments to the collection. If necessary and possible, the collection will be enlarged: if enlarging the collection is not possible, then a runtime exception will be thrown. Augmentation of the Collection.addAll(Collection) API method.

Returns:
true if the state of the collection was changed.

append

public static <T,TCollection extends java.util.Collection<? super T>> TCollection append(TCollection cout,
                                                                                         java.lang.Iterable<T> iterable)
Adds all of the elements of the iterable resource to the collection and returns the collection. If necessary and possible, the collection will be enlarged: if enlarging the collection is not possible, then a runtime exception is thrown.


append

public static <T,TCollection extends java.util.Collection<? super T>> TCollection append(TCollection cout,
                                                                                         java.util.Iterator<T> iter)
Adds all of the elements of the iterator to the collection and returns the collection. If necessary and possible, the collection will be enlarged: if enlarging the collection is not possible, then a runtime exception is thrown.


append

public static <T,TCollection extends java.util.Collection<? super T>> TCollection append(TCollection cout,
                                                                                         T... values)
Adds all of the arguments to the collection and returns the collection. If necessary and possible, the collection will be enlarged: if enlarging the collection is not possible, then the runtime exception thrown. A similar method exists in Java 1.5, although it returns boolean rather than the collection.



Copyright © 2002-2006 David A. Hall. All Rights Reserved.