交集

欢马劈雪     最近更新时间:2020-01-02 10:19:05

504
交集

/**
 from
* N o  w  J a v a . c o m - 时  代  Java 
**/

//package com.nowjava;

import java.util.HashSet;

import java.util.Iterator;


public class Main {


    public static HashSet<String> intersectionSet(HashSet<String> setA,

            HashSet<String> setB) {

        HashSet<String> intersectionSet = new HashSet<String>();

        Iterator<String> iterA = setA.iterator();

        while (iterA.hasNext()) {

            String tempInner = iterA.next();

            if (setB.contains(tempInner)) {

                intersectio
展开阅读全文