Here you can find the source of compare(String str, List
public static boolean compare(String str, List<String> list)
//package com.java2s; import java.util.List; public class Main { /** @METHOD */ public static boolean compare(String str, List<String> list) { String x = str.replace(" ", ""); x = x.replace("[", "").replace("]", ""); String y = list.toString().replace(" ", ""); y = y.replace("[", "").replace("]", ""); return x.equals(y); }/*w w w . j a v a 2s .co m*/ }