Java Collection Equal compareTwoCollectionsEquality(Collection expectedAffectedFiles, Collection affectedFiles)

Here you can find the source of compareTwoCollectionsEquality(Collection expectedAffectedFiles, Collection affectedFiles)

Description

compare Two Collections Equality

License

Open Source License

Parameter

Parameter Description
expectedAffectedFiles a parameter
affectedFiles a parameter

Declaration

public static boolean compareTwoCollectionsEquality(Collection<String> expectedAffectedFiles,
        Collection<String> affectedFiles) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010 Red Hat, Inc.//  w  ww . j  ava  2s . co  m
 * Distributed under license by Red Hat, Inc. All rights reserved.
 * This program is made available under the terms of the
 * Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 * Red Hat, Inc. - initial API and implementation
 ******************************************************************************/

import java.util.Collection;

public class Main {
    /**
     * 
     * @param expectedAffectedFiles
     * @param affectedFiles
     * @return
     */
    public static boolean compareTwoCollectionsEquality(Collection<String> expectedAffectedFiles,
            Collection<String> affectedFiles) {
        int counter = 0;
        for (String f1 : affectedFiles) {
            for (String f2 : expectedAffectedFiles) {
                if (f1.equals(f2)) {
                    counter++;
                }
            }
        }
        return expectedAffectedFiles.size() == counter;
    }
}

Related

  1. allEqual(Class[] collection, Class cls)
  2. allEqual(final Class[] collection, final Class cls)
  3. areEqual(Collection collection1, Collection collection2)
  4. areEqual(Collection collection1, Collection collection2)
  5. containsAtleastOneEqualString(Collection left, String right)
  6. containsByEquals(Collection collection, Object obj)
  7. content_equality(Collection A, Collection B)
  8. contentEquals(Collection l1, Collection l2)