Java Collection Equal isEqualBasicCol(Collection col1, Collection col2)

Here you can find the source of isEqualBasicCol(Collection col1, Collection col2)

Description

is Equal Basic Col

License

Open Source License

Parameter

Parameter Description
col1 a parameter
col2 a parameter

Declaration

public static int isEqualBasicCol(Collection col1, Collection col2) 

Method Source Code


//package com.java2s;

import java.util.Collection;

public class Main {
    private final static int B_FALSE = 0;
    private final static int B_UNKNOWN = 1;
    private final static int B_TRUE = 2;

    /**/*w  w w  . j  a  v  a  2 s.c o m*/
     * @param col1
     * @param col2
     * @return
     */
    public static int isEqualBasicCol(Collection col1, Collection col2) {
        if (col1 == col2) {
            return B_TRUE;
        } else if (col1 == null || col2 == null) {
            if (col1 == null) {
                if (col2.size() == 0)
                    return B_TRUE;
                else
                    return B_FALSE;
            } else {
                if (col1.size() == 0)
                    return B_TRUE;
                else
                    return B_FALSE;
            }
        } else {
            if (col1.size() == col2.size())
                return B_UNKNOWN;
            else
                return B_FALSE;
        }
    }
}

Related

  1. isContentEqual(final Collection collectionA, final Collection collectionB)
  2. isEqual(Collection left, Collection right)
  3. isEqual(Collection one, Collection two)
  4. isEqual(Collection coll, Comparator comp)
  5. isEqual(Collection a, Collection b)
  6. isEqualCollection(final Collection a, final Collection b)
  7. isEqualCollection(final Collection a, final Collection b)
  8. isEqualDeep(Collection a, Collection b)
  9. isEquals(Collection set1, Collection set2)