Skip to content

Add method to Safeable to map null to a particular value #202

Description

@dalewking

When encountering a null value for Safeable often you just want to map that to one of the existing enum values and one can do that in the accessing code with Elvis operator and perhaps some added parentheses, but it would seem to me that it would improve readability if Safeable had a method like:

   fun valueOrElse(defaultValue: T) = value ?: defaultValue

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions