@Test public void testCreateWhenNull() { final List<Integer> list = new ArrayList<Integer>(); final List<Integer> nullList = null; assertThat(Lists.createWhenNull(list), is(notNullValue())); assertThat(Lists.createWhenNull(list), is(list)); assertThat(Lists.createWhenNull(nullList), is(notNullValue())); }
public static <T> List<T> createWhenNull(final List<T> list) { if (list == null) { return new ArrayList<T>(); } else { return list; } }
Lists { public static <T> List<T> createWhenNull(final List<T> list) { if (list == null) { return new ArrayList<T>(); } else { return list; } } }
Lists { public static <T> List<T> createWhenNull(final List<T> list) { if (list == null) { return new ArrayList<T>(); } else { return list; } } private  Lists(); }
Lists { public static <T> List<T> createWhenNull(final List<T> list) { if (list == null) { return new ArrayList<T>(); } else { return list; } } private  Lists(); static List<T> createWhenNull(final List<T> list); static List<T> create(final T item); static T firstEntry(final List<T> list); static boolean isEmpty(final List<?> list); static boolean isNotEmpty(final List<?> list); static boolean sizeIs(final List<?> list, final int size); static List<T> emptyToNull(final List<T> list); }
Lists { public static <T> List<T> createWhenNull(final List<T> list) { if (list == null) { return new ArrayList<T>(); } else { return list; } } private  Lists(); static List<T> createWhenNull(final List<T> list); static List<T> create(final T item); static T firstEntry(final List<T> list); static boolean isEmpty(final List<?> list); static boolean isNotEmpty(final List<?> list); static boolean sizeIs(final List<?> list, final int size); static List<T> emptyToNull(final List<T> list);  }