Example usage for java.util LinkedList equals

List of usage examples for java.util LinkedList equals

Introduction

In this page you can find the example usage for java.util LinkedList equals.

Prototype

boolean equals(Object o);

Source Link

Document

Compares the specified object with this list for equality.

Usage

From source file:org.apache.axis2.context.externalize.ActivateUtils.java

/**
 * Compares the two collections to see if they are equivalent.
 * //from www.  j a  va2  s . c om
 * @param l1  The first collection
 * @param l2  The second collection
 * @return TRUE if the two collections are equivalent
 *         FALSE, otherwise
 */
public static boolean isEquivalent(LinkedList l1, LinkedList l2) {
    if ((l1 != null) && (l2 != null)) {
        // This is a strict test.
        // Returns true if the specified object is also a list, 
        // both lists have the same size, and all corresponding pairs 
        // of elements in the two lists are equal where
        // they contain the same elements in the same order.
        return (l1.equals(l2));
    } else if ((l1 == null) && (l2 == null)) {
        return true;
    } else {
        // mismatch
        return false;
    }
}