Here you can find the source of compare(List
public static int compare(List<String> a, List<String> b)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static int compare(List<String> a, List<String> b) { if (a.size() == 0 || b.size() == 0) { return 0; }/* www . j ava 2 s . c o m*/ if (a.size() <= b.size()) { for (String x : a) { boolean z = false; for (String y : b) { if (x.equals(y)) { z = true; break; } } if (!z) return 0; } return -1; } else { for (String x : b) { boolean z = false; for (String y : a) { if (x.equals(y)) { z = true; break; } } if (!z) return 0; } return 1; } } }