Java tutorial
//package com.java2s; import android.support.annotation.Nullable; import java.util.List; public class Main { @Nullable public static String[] nullableArrayOfStrings(@Nullable List<String> list) { return list == null || list.isEmpty() ? null : list.toArray(new String[list.size()]); } }