Interface SafeSpecializable<S>

    • Method Detail

      • as

        default <T extends SOptional<T> as​(Class<T> type)
        Get this instance as a desired subtype.

        If the instance is not castable to the specified type, the Optional will be empty.

        If the passed type is null, an empty Optional will be returned.

        Specified by:
        as in interface Specializable<S>
        Type Parameters:
        T - The desired type.
        type - The type as which to obtain this instance.
        Returns an Optional of this instance if it could be cast, otherwise an empty result.