Here you can find the source of equalLists(List
public static boolean equalLists(List<String> one, List<String> two)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static boolean equalLists(List<String> one, List<String> two) { if (one == null && two == null) { return true; }//from w w w . ja va 2 s.c om if ((one == null && two != null) || one != null && two == null || one.size() != two.size()) { return false; } ArrayList<String> oneCopy = new ArrayList<>(one); ArrayList<String> twoCopy = new ArrayList<>(two); Collections.sort(oneCopy); Collections.sort(twoCopy); return one.equals(twoCopy); } }