P01 { public static <T> T last(List<T> elements) { int numberOfElements = elements.size(); return elements.get(numberOfElements - 1); }  static T last(List<T> elements); static T last(LinkedList<T> elements); static T lastRecursive(List<T> elements);  }
@Test public void shouldFindLastElementFromAListOfAlphabets() throws Exception { assertThat(P01.last(asList("a", "b", "c", "d")), is(equalTo("d"))); }
@Test public void shouldFindLastElementFromALinkedListOfAlphabets() throws Exception { LinkedList<String> alphabets = linkedList("a", "b", "c", "d"); assertThat(P01.last(alphabets), is(equalTo("d"))); }