Java Collection Add add_news(Collection target, Collection to_add)

Here you can find the source of add_news(Collection target, Collection to_add)

Description

adnews

License

Open Source License

Declaration

public static <T> void add_news(Collection<T> target, Collection<? extends T> to_add) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

import java.util.Iterator;

public class Main {
    public static <T> void add_news(Collection<T> target, Collection<? extends T> to_add) {
        for (Iterator<? extends T> it = to_add.iterator(); it.hasNext();) {
            T element = it.next();/*from w w w  .j av a2s  .  c  o m*/
            if (!target.contains(element))
                target.add(element);
        }
    }
}

Related

  1. add(Collection c, Object o)
  2. add(Collection collection, T object)
  3. add(Collection collection, T object)
  4. add_all(Collection target, Collection source)
  5. addAll(C collection, Iterable add)
  6. addAll(C collection, T... elements)
  7. addAll(Collection collection, Iterator iterator)
  8. addAll(Collection collection, Object[] array)