Here you can find the source of containsOrIsEmpty(List
public static boolean containsOrIsEmpty(List<String> list, Object item)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static boolean containsOrIsEmpty(List<String> list, Object item) { if (list == null || list.isEmpty() || list.contains(item)) return true; return false; }/*w w w.j av a 2 s . com*/ public static boolean contains(List<String> list, String item) { if (list == null) return false; return list.contains(item); } }