### Question:
StreamApi { public static Integer getInfiniteStreamLastElementUsingReduce() { Stream<Integer> stream = Stream.iterate(0, i -> i + 1); return stream.limit(20).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 givenInfiniteStream_whenGetInfiniteStreamLastElementUsingReduce_thenReturnLastElement() { int last = StreamApi.getInfiniteStreamLastElementUsingReduce(); assertEquals(19, last); }