List of utility methods to do Collection Add
T | addAll(T coll, Collection add All coll.addAll(other);
return coll;
|
void | addAll(T[] lhs, Collection Add all elements from an array into a given collection of the same type. for (int i = 0; i != lhs.length; ++i) { rhs.add(lhs[i]); |
void | addAllFirst(Collection add All First for (T item : col) {
deque.addFirst(item);
|
boolean | addAllIfNotNull(final Collection super E> collection, final Collection extends E> c) add All If Not Null return (collection != null) && (c != null) && collection.addAll(c);
|
void | addAllIfNotNull(final Collection add All If Not Null if (collection != null && values != null) {
collection.addAll(values);
|
boolean | addAllIfSet(Collection Adds all of the elements in the specified collection to the target collection if a collection is specified. if (c == null) return false; return target.addAll(c); |
boolean | addAllIgnoreNull(Collection super T> c, T... elements) Null elements are not taking into account. boolean result = false; for (T element : elements) { if (element != null) { result |= c.add(element); return result; |
boolean | addAllIgnoreNull(final Collection Add elements from a source collection to a target collection unless they or the source collection itself are null. if (target == null) throw new NullPointerException("The target collection must not be null"); if (source == null) return false; boolean changed = false; for (T element : source) changed |= addIgnoreNull(target, element); return changed; ... |
void | addAllNotNull(final Collection super E> c, final E... elements) adds all not null elements to the specified collection if (elements == null) { return; for (final E e : elements) { addIfNotNull(e, c); |
Collection | addAllOrSame(Collection Adds to a collection all given new elements in a second collection, returning the second collection same instance if the first is null or empty. Collection<T> result; if (collection == null || collection.isEmpty()) { result = newElements; } else { collection.addAll(newElements); result = collection; return result; ... |