Here you can find the source of compareListsAndNull(List arg1, List arg2)
public static boolean compareListsAndNull(List arg1, List arg2)
//package com.java2s; //License from project: Open Source License import java.util.List; public class Main { public static boolean compareListsAndNull(List arg1, List arg2) { if (arg1 == null && arg2 == null) { return true; } else if ((arg1 == null && arg2 != null) || (arg1 != null && arg2 == null) || arg1.size() != arg2.size()) { return false; } else {// ww w.j a va 2s .co m for (int i = 0; i < arg1.size(); i++) { if (!compareObjectsAndNull(arg1.get(i), arg2.get(i))) { return false; } } return true; } } public static boolean compareObjectsAndNull(Object object1, Object object2) { if ((object1 == null && object2 == null) || (object1 != null && object1.equals(object2))) { return true; } else { return false; } } }