Union set to Collection - Android java.util

Android examples for java.util:Collection Union

Description

Union set to Collection

Demo Code


//package com.book2s;
import java.util.Collection;

import java.util.Set;

public class Main {

    public static <T> Set<T> unionTo(Set<T> dest, Collection<T> src) {
        for (T object : src) {
            if (!dest.contains(object)) {
                dest.add(object);//www.j  a  va2  s .  co m
            }
        }

        return dest;
    }
}

Related Tutorials