Java List Equal equals(List lst1, List lst2)

Here you can find the source of equals(List lst1, List lst2)

Description

equals

License

Apache License

Declaration

public static boolean equals(List lst1, List lst2) 

Method Source Code

//package com.java2s;
/**//w  w w  .  jav a2  s . c  o  m
 * Copyright 2016 William Van Woensel
    
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
    
   http://www.apache.org/licenses/LICENSE-2.0
    
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 * 
 * 
 * @author wvw
 * 
 */

import java.util.List;

public class Main {
    public static boolean equals(List lst1, List lst2) {
        if (lst1.size() != lst2.size())
            return false;

        for (Object obj1 : lst1) {

            boolean match = false;
            for (Object obj2 : lst2) {

                if (obj1.equals(obj2)) {
                    match = true;

                    break;
                }
            }

            if (!match)
                return false;
        }

        return true;
    }
}

Related

  1. equalLists(List a, List b)
  2. equals(final List fromList, final List key, final int start)
  3. equals(List A, List B)
  4. equals(List c1, List c2)
  5. equals(List list1, List list2)
  6. equals(List l1, List l2)
  7. equals(List list, Object o)
  8. equals(List l1, List l2, boolean ignoreCase)
  9. equals(List list1, List list2)