ArrayUtil { public static <T> List<T> asList(T... a) { return Arrays.asList(a); }  @SuppressWarnings("unchecked") static T[] newArray(Class<T> type, int length); @SuppressWarnings("unchecked") static T[] toArray(Collection<T> col, Class<T> type); static T[] shuffle(T[] array); static T[] shuffle(T[] array, Random random); static T[] concat(@Nullable T element, T[] array); static T[] concat(T[] array, @Nullable T element); static List<T> asList(T... a); static List<Integer> intAsList(int... backingArray); static List<Long> longAsList(long... backingArray); static List<Double> doubleAsList(double... backingArray);  }
@Test public void asList() { List<String> list = ArrayUtil.asList("d", "a", "c", "b", "e", "i", "g"); assertThat(list).hasSize(7).containsExactly("d", "a", "c", "b", "e", "i", "g"); try { list.add("a"); fail("should fail before"); } catch (Throwable t) { assertThat(t).isInstanceOf(UnsupportedOperationException.class); } List<Integer> list3 = ArrayUtil.intAsList(1, 2, 3); assertThat(list3).hasSize(3).containsExactly(1, 2, 3); List<Long> list4 = ArrayUtil.longAsList(1L, 2L, 3L); assertThat(list4).hasSize(3).containsExactly(1L, 2L, 3L); List<Double> list5 = ArrayUtil.doubleAsList(1.1d, 2.2d, 3.3d); assertThat(list5).hasSize(3).containsExactly(1.1d, 2.2d, 3.3d); }