Java tutorial
//package com.java2s; import java.util.*; public class Main { public static <I> List<I> toList(I... xs) { if (isNotEmpty(xs)) { return Arrays.asList(xs); } return Collections.emptyList(); } private static <I> boolean isNotEmpty(I[] xs) { return xs != null && xs.length > 0; } public static <I> boolean isNotEmpty(List<I> xs) { return xs != null && xs.size() > 0; } }