P05 { public static <T> List<T> reverse(List<T> list) { if (list == null) { throw new IllegalArgumentException("list can't be null"); } Collections.reverse(list); return list; }  static List<T> reverse(List<T> list); static List<T> reverse_foreach(List<T> list); static List<T> reverse_IntStream(List<T> list); static List<T> reverse_customStream(ArrayDeque<T> list); static List<T> reverse(LinkedList<T> elements);  }
@Test public void shouldReverseAList() throws Exception { List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5); assertThat(P05.reverse(numbers), is(equalTo(Arrays.asList(5, 4, 3, 2, 1)))); }