@Test public void testToListTArray() { assertThat(CollectionHelper.toList()).isNull(); assertThat(CollectionHelper.toList(1)).isInstanceOf(List.class) .containsExactly(1); assertThat(CollectionHelper.toList(1, 2, 3)).isInstanceOf(List.class) .containsExactly(1, 2, 3); }
@SafeVarargs @Nullable public static <T> List<T> toList(@Nullable T... arguments) { if (arguments != null) { if (arguments.length == 1) { return Collections.singletonList(arguments[0]); } if (arguments.length > 1) { return Arrays.asList(arguments); } } return null; }
CollectionHelper { @SafeVarargs @Nullable public static <T> List<T> toList(@Nullable T... arguments) { if (arguments != null) { if (arguments.length == 1) { return Collections.singletonList(arguments[0]); } if (arguments.length > 1) { return Arrays.asList(arguments); } } return null; } }
CollectionHelper { @SafeVarargs @Nullable public static <T> List<T> toList(@Nullable T... arguments) { if (arguments != null) { if (arguments.length == 1) { return Collections.singletonList(arguments[0]); } if (arguments.length > 1) { return Arrays.asList(arguments); } } return null; }  }
CollectionHelper { @SafeVarargs @Nullable public static <T> List<T> toList(@Nullable T... arguments) { if (arguments != null) { if (arguments.length == 1) { return Collections.singletonList(arguments[0]); } if (arguments.length > 1) { return Arrays.asList(arguments); } } return null; }  @SafeVarargs @Nullable static List<T> toList(@Nullable T... arguments); @SuppressWarnings("unchecked") @Nullable static List<Object> toList(@Nullable Collection<T> collection); @Nullable static Set<Long> toSet(@Nullable Collection<Long> collection); }
CollectionHelper { @SafeVarargs @Nullable public static <T> List<T> toList(@Nullable T... arguments) { if (arguments != null) { if (arguments.length == 1) { return Collections.singletonList(arguments[0]); } if (arguments.length > 1) { return Arrays.asList(arguments); } } return null; }  @SafeVarargs @Nullable static List<T> toList(@Nullable T... arguments); @SuppressWarnings("unchecked") @Nullable static List<Object> toList(@Nullable Collection<T> collection); @Nullable static Set<Long> toSet(@Nullable Collection<Long> collection);  }