Copy one Set to another Set - Android java.util

Android examples for java.util:Set

Description

Copy one Set to another Set

Demo Code


//package com.book2s;

import java.util.Iterator;

import java.util.Set;

public class Main {

    public static <E> void copySet(Set<E> src, Set<E> dest) {
        for (Iterator<E> it = src.iterator(); it.hasNext();) {
            dest.add(it.next());/* w w w  .  j  a v a 2s .c  o  m*/
        }
    }
}

Related Tutorials