@ SafeVarargs public static < T > @ NonNull Optional < T > first ( final @ NonNull Optional < T > ... optionals ) { return Arrays . stream ( optionals ) . filter ( Optional :: isPresent ) . findFirst ( ) . orElse ( Optional . empty ( ) ) ; }
Gets the first optional with a present value .