### Question:
Utils { @SafeVarargs public static <T> List<T> varargsToList(T head, T ...tail) { if (tail.length == 0) { return Collections.singletonList(head); } else { List<T> list = new ArrayList<>(); list.add(head); list.addAll(Arrays.asList(tail)); return list; } }  static List<T> unmodifiableList(List<T> list); @SafeVarargs static List<T> varargsToList(T head, T ...tail);  }### Answer:
@Test public void varargsToList() throws Exception { assertEquals(Arrays.asList(1, 2, 3, 4), Utils.varargsToList(1, 2, 3, 4)); }
@Test public void varargsToListSingleElement() throws Exception { assertEquals(Collections.singletonList("a"), Utils.varargsToList("a")); }