reactor-core/src/main/java/reactor/core/publisher/Flux.java
public final Mono<T> last() {
	    if (this instanceof Callable) {
		    @SuppressWarnings("unchecked")
		    Callable<T> thiz = (Callable<T>) this;
		    Mono<T> callableMono = convertToMono(thiz);
		    if (callableMono == Mono.empty()) {
			    return Mono.error(new NoSuchElementException("Flux#last() didn't observe any onNext signal from Callable flux"));
		    }
	        return callableMono;
	    }
		return Mono.onAssembly(new MonoTakeLastOne<>(this));
	}
public final Mono<T> last() {
	    if (this instanceof Callable) {
		    @SuppressWarnings("unchecked")
		    Callable<T> thiz = (Callable<T>) this;
		    Mono<T> callableMono = convertToMono(thiz);
		    if (callableMono == Mono.empty()) {
			    return Mono.error(new NoSuchElementException("Flux#last() didn't observe any onNext signal from Callable flux"));
		    }
	        return callableMono;
	    }
		return Mono.onAssembly(new MonoTakeLastOne<>(this));
	}
public final Mono < T > last ( ) { if ( this instanceof Callable ) { @ SuppressWarnings ( "unchecked" ) Callable < T > thiz = ( Callable < T > ) this ; Mono < T > callableMono = convertToMono ( thiz ) ; if ( callableMono == Mono . empty ( ) ) { return Mono . error ( new NoSuchElementException ( "Flux#last() didn't observe any onNext signal from Callable flux" ) ) ; } return callableMono ; } return Mono . onAssembly ( new MonoTakeLastOne <> ( this ) ) ; }
Emit the last element observed before complete signal as a {@link Mono}, or emit
{@link NoSuchElementException} error if the source was empty.
For a passive version use {@link #takeLast(int)}

<p>
<img class="marble" src="doc-files/marbles/last.svg" alt="">

@reactor.discard This operator discards elements before the last.

@return a {@link Mono} with the last value in this {@link Flux}
Emit the last element observed before complete signal as a { @link Mono } or emit { @link NoSuchElementException } error if the source was empty . For a passive version use { @link #takeLast ( int ) }