### Question:
StreamApi { public static String getLastElementUsingReduce(List<String> valueList) { Stream<String> stream = valueList.stream(); return stream.reduce((first, second) -> second).orElse(null); }  static String getLastElementUsingReduce(List<String> valueList); static Integer getInfiniteStreamLastElementUsingReduce(); static String getLastElementUsingSkip(List<String> valueList);  }### Answer:
@Test public void givenList_whenGetLastElementUsingReduce_thenReturnLastElement() { List<String> valueList = new ArrayList<>(); valueList.add("Joe"); valueList.add("John"); valueList.add("Sean"); String last = StreamApi.getLastElementUsingReduce(valueList); assertEquals("Sean", last); }