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

intaddAll(final Collection coll, final T... objs)
add All
int i = 0;
for (final T e : objs) {
    if (coll.add(e)) {
        i++;
return i;
intaddAll(final Collection collection, final T... elements)
add All
if (elements == null)
    return 0;
int count = 0;
for (final T elem : elements)
    if (collection.add(elem))
        count++;
return count;
booleanaddAll(final Collection collection, final T... objects)
Adds all objects into the specified list.
boolean result = false;
for (final T object : objects) {
    if (!collection.contains(object)) {
        result |= collection.add(object);
return result;
booleanaddAll(final Collection collection, final T... objects)
Adds all objects into the specified list.
boolean result = false;
for (final T object : objects) {
    if (!collection.contains(object)) {
        result |= collection.add(object);
return result;
CollectionaddAll(final Collection collection, final T[] items)
add All
if (null != items) {
    if (null != collection) {
        Collections.addAll(collection, items);
return collection;
intaddAll(final T[] source, final Collection destination)
add All
int count = 0;
for (final T sourceItem : source) {
    destination.add(sourceItem);
    ++count;
return count;
TCollectionaddAll(final TCollection target, final Iterable source)
Adds all the elements of the given source to the given target collection.
if (target != null && source != null) {
    for (TElement element : source) {
        target.add(element);
return target;
voidaddAll(Iterable iterable, Collection collection)
Add all elements from the given iterable into the given collection
for (T t : iterable) {
    collection.add(t);
voidaddAll(Iterable iterable, Collection collection)
add All
for (T item : iterable)
    collection.add(item);
SaddAll(S collection, T... values)
Add all elements to the collection
collection.addAll(Arrays.asList(values));
return collection;