Java examples for java.util:Collection Search
checks for a null list and returns Collections.emptyList in that case.
//package com.java2s; import java.util.Collections; import java.util.List; public class Main { public static void main(String[] argv) { List list = java.util.Arrays.asList("asdf", "java2s.com"); System.out.println(getListValue(list)); }//from w ww. ja va 2s .c o m public static <T> List<T> getListValue(List<T> list) { if (list == null) { return Collections.emptyList(); } return list; } }