Java Collection Add addAllIfNotNull(final Collection collection, final Collection c)

Here you can find the source of addAllIfNotNull(final Collection collection, final Collection c)

Description

add All If Not Null

License

Apache License

Declaration

public static <E> boolean addAllIfNotNull(final Collection<? super E> collection,
            final Collection<? extends E> c) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Collection;

public class Main {
    public static <E> boolean addAllIfNotNull(final Collection<? super E> collection,
            final Collection<? extends E> c) {
        return (collection != null) && (c != null) && collection.addAll(c);
    }// w  w w  .  ja va 2  s  .c om
}

Related

  1. addAll(Iterable iterable, Collection collection)
  2. addAll(S collection, T... values)
  3. addAll(T coll, Collection other)
  4. addAll(T[] lhs, Collection rhs)
  5. addAllFirst(Collection col, Deque deque)
  6. addAllIfNotNull(final Collection collection, final Collection values)
  7. addAllIfSet(Collection target, Collection c)
  8. addAllIgnoreNull(Collection c, T... elements)
  9. addAllIgnoreNull(final Collection target, final Collection source)