Here you can find the source of areEqual(List> list1, List> list2)
public static boolean areEqual(List<?> list1, List<?> list2)
//package com.java2s; /**//www .ja va 2s . c om * Copyright (c) 2007 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM - Initial API and implementation */ import java.util.List; public class Main { public static boolean areEqual(List<?> list1, List<?> list2) { if (list1 == null) return list2 == null; if (list2 == null) return false; int size = list1.size(); if (size != list2.size()) { return false; } for (int i = 0; i < size; i++) { if (list1.get(i) != list2.get(i)) { if (list1.get(i) == null || list2.get(i) == null) { return false; } else if (!list1.get(i).equals(list2.get(i))) { return false; } } } return true; } }