Java List check if List is not empty

Description

Java List check if List is not empty


import java.util.List;

public class Main {
    public static void main(String[] argv) throws Exception {
        List t = java.util.Arrays.asList("Javascript", "HTML", "CSS", "Java", "demo2s.com");
        System.out.println(listNotNull(t));
    }//from w  w  w.j  a  v  a2  s  .com

    public static <T> boolean listNotNull(List<T> t) {
        if (t != null && t.size() > 0) {
            return true;
        } else {
            return false;
        }
    }
}



PreviousNext

Related