Optional.orElseThrow

Gets the value of this optional if it exists, or throws an exception.

  1. T orElseThrow(string msg)
    struct Optional(T)
    T
    orElseThrow
    (
    string msg = "Optional value is null."
    )
  2. T orElseThrow(Exception delegate() exceptionSupplier)

Parameters

msg string

A message to put in the exception.

Return Value

Type: T

The value of this optional.