Java Set Compare compareSet(Set set1, Set set2)

Here you can find the source of compareSet(Set set1, Set set2)

Description

compare Set

License

Apache License

Declaration

public static int compareSet(Set set1, Set set2) 

Method Source Code

//package com.java2s;
/**// w ww.j  a  v a  2s . c  o m
 * Copyright (c) 2005-2009 springside.org.cn
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *
 * $Id: ReflectionUtils.java,v 1.1 2014/11/10 06:38:51 daiyl Exp $
 */

import java.util.*;

public class Main {

    public static int compareSet(Set set1, Set set2) {
        int sameCount = 0;
        for (Object o : set1) {
            if (set2.contains(o))
                sameCount++;
        }
        return sameCount;
    }
}

Related

  1. compareSets(Set resSet, Set initSet)