Java Utililty Methods Collection Add

List of utility methods to do Collection Add

Description

The list of methods to do Collection Add are organized into topic(s).

Method

voidaddAllSafe(Collection collection1, Collection collection2)
Adds all elements of collection2 to collection1.
if (collection2 != null) {
    collection1.addAll(collection2);
voidaddAllUncontained(Collection col1, Collection col2)
Adds all elements from col2 to col1, if they're not already contained.
for (T t : col2) {
    if (!col1.contains(t)) {
        col1.add(t);
booleanaddAllUnique(final Collection collection, final Collection values)
add a collection of values to a collection.
boolean changed = false;
for (final Iterator iter = values.iterator(); iter.hasNext();) {
    changed = addUnique(collection, iter.next());
return changed;
CollectionaddArray(Collection col, T[] array)
Adds the whole array to the collection.
if (array == null) {
    return col;
for (T a : array) {
    col.add(a);
return col;
java.util.CollectionaddArray(java.util.Collection v, T array[])
add Array
if ((array == null) || (v == null)) {
    return v;
for (int i = 0; i < array.length; i++) {
    v.add(array[i]);
return v;
voidaddArrayToCollection(T[] array, Collection collection)
add Array To Collection
for (int i = 0; i < array.length; i++) {
    if (array[i] != null) {
        collection.add(array[i]);
voidaddArrayToCollection(T[] array, Collection collection)
Adds all array elements to the given collection of the same type.
if (collection == null) {
    collection = new ArrayList<T>();
for (T o : array) {
    collection.add(o);
voidaddCheck(Collection c, Object o)
add Check
if (o != null) {
    c.add(o);
ListaddCollections(Collection... inCollections)
add Collections
return addCollections(true, inCollections);
voidaddCondition(Collection conditions, String condition, double value)
add Condition
addConditionImpl(conditions, condition, String.valueOf(value));