Java List Equal areEqualConsideringOrder(List listA, List listB)

Here you can find the source of areEqualConsideringOrder(List listA, List listB)

Description

are Equal Considering Order

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static boolean areEqualConsideringOrder(List listA, List listB) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;

public class Main {
    @SuppressWarnings("unchecked")
    public static boolean areEqualConsideringOrder(List listA, List listB) {
        return !areDifferentConsideringOrder(listA, listB);
    }// w ww .  j  a v  a2 s  .c  o  m

    @SuppressWarnings("unchecked")
    public static boolean areDifferentConsideringOrder(List listA, List listB) {
        if (listA.size() != listB.size()) {
            return true;
        }
        for (int i = 0; i < listA.size(); i++) {
            Object valueA = listA.get(i);
            Object valueB = listB.get(i);
            if (!valueA.equals(valueB)) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. areEqual(final List list1, final List list2)
  2. areEqual(List a, List b)
  3. areEqual(List list1, List list2)
  4. equal(List coll, List otherColl)
  5. equal(List objects)
  6. equal(List v1, List v2)
  7. equalLists(List a, List b)