code: public static <T> Collector<T, ?, Optional<T>> last() {
          return Collectors.reducing((u, v) -> v);
      }
docs: Returns a {@code Collector} which collects only the last stream element
  if any.
  
  @param <T> the type of the input elements
  @return a collector which returns an {@link Optional} which describes the
  last element of the stream. For empty stream an empty
  {@code Optional} is returned.